Weird Errors When Trying To Insert With IDENTITY_INSERT On!

Oct 30, 2006

SQL Server 2000 (DDL below)

If I try to run this code in QA:

SET IDENTITY_INSERT tblAdminUsers ON
INSERT INTO tblAdminUsers
(fldUserID,
fldUsername,
fldPassword,
fldFullname,
fldPermission,
fldEmail,
fldInitials,
fldLastLogon,
fldBatch)
SELECT
fldUserID,
fldUsername,
fldPassword,
fldFullname,
fldPermission,
fldEmail,
fldInitials,
fldLastLogon,
fldBatch
FROM
[BSAVA_26-10-2006].dbo.tblAdminUsers
SET IDENTITY_INSERT tblAdminUsers OFF

I get an error:
IDENTITY_INSERT is already ON for table
'BSAVA_Archive_Test_2006.dbo.GPS_CHAR'. Cannot perform SET operation
for table 'tblAdminUsers'.

If I try to run:
INSERT INTO tblAdminUsers
(fldUserID,
fldUsername,
fldPassword,
fldFullname,
fldPermission,
fldEmail,
fldInitials,
fldLastLogon,
fldBatch)
SELECT
fldUserID,
fldUsername,
fldPassword,
fldFullname,
fldPermission,
fldEmail,
fldInitials,
fldLastLogon,
fldBatch
FROM
[BSAVA_26-10-2006].dbo.tblAdminUsers

I get the error:
Cannot insert explicit value for identity column in table
'tblAdminUsers' when IDENTITY_INSERT is set to OFF.

Anyone any ideas? FYI the tables I'm INSERTing into were scripted from
the [BSAVA_26-10-2006] tables.

TIA

Edward

=====================
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[tblAdminUsers]') and OBJECTPROPERTY(id,
N'IsUserTable') = 1)
drop table [dbo].[tblAdminUsers]
GO

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[GPS_CHAR]') and OBJECTPROPERTY(id, N'IsDefault') =
1)
drop default [dbo].[GPS_CHAR]
GO

create default dbo.GPS_CHAR AS ''

CREATE TABLE [dbo].[tblAdminUsers] (
[fldUserID] [int] IDENTITY (1, 1) NOT NULL ,
[fldUsername] [varchar] (20) COLLATE Latin1_General_CI_AS NULL ,
[fldPassword] [varchar] (20) COLLATE Latin1_General_CI_AS NULL ,
[fldFullname] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[fldPermission] [smallint] NULL ,
[fldEmail] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
[fldInitials] [varchar] (3) COLLATE Latin1_General_CI_AS NULL ,
[fldLastLogon] [smalldatetime] NULL ,
[fldBatch] [char] (1) COLLATE Latin1_General_CI_AS NULL
) ON [PRIMARY]
GO

View 10 Replies


ADVERTISEMENT

Weird Dtexec Errors

Jun 18, 2007



I receive the error below when running a package using dtexec. The package itself runs ok, however. That is, my data loads into the table.



All this package does is execute 3 separate Execute SQL tasks that are simple insert statements into a table.



There are NO script tasks or components in the package. So what is this weird error about?





Error: 2007-06-18 18:01:49.36
Code: 0xC0012024
Source: Script Task
Description: The task "Script Task" cannot run on this edition of Integration
Services. It requires a higher level edition.
End Error
Warning: 2007-06-18 18:01:49.36
Code: 0x80019002
Source: OnPostExecute
Description: The Execution method succeeded, but the number of errors raised
(2) reached the maximum allowed (1); resulting in failure. This occurs when the
number of errors reaches the number specified in MaximumErrorCount. Change the M
aximumErrorCount or fix the errors.
End Warning

View 4 Replies View Related

Errors With DateTime Conversion -- This One's A Weird One.

Jan 15, 2008

So what I'm trying to do is audit changes on a server. I'm creating a DDL trigger as below:




Code Block

CREATE trigger DDL_changeTracking_tr
on Database
FOR CREATE_TABLE, ALTER_TABLE, DROP_TABLE,
CREATE_FUNCTION, ALTER_FUNCTION, DROP_FUNCTION,
CREATE_PROCEDURE, ALTER_PROCEDURE, DROP_PROCEDURE,
CREATE_TRIGGER, ALTER_TRIGGER, DROP_TRIGGER,
CREATE_VIEW, ALTER_VIEW, DROP_VIEW
as
SET NOCOUNT ON
SET ANSI_WARNINGS ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET NUMERIC_ROUNDABORT OFF
SET QUOTED_IDENTIFIER ON

BEGIN TRY
BEGIN
declare @login varchar(100)
set @login = eventData().value('(/EVENT_INSTANCE/LoginName)[1]', 'varchar(100)')

if (@login <> 'sqladmin' and @login <> 'sqlagentadmin')
BEGIN
insert into DBMonitoring..audit_tbl (databaseId, auditTime, loginName, objectName, objectType, eventType)
select
DB_ID() as databaseId
, getDate() as auditTime
, eventData().value('(/EVENT_INSTANCE/SchemaName)[1]', 'varchar(100)') + '.' +
eventData().value('(/EVENT_INSTANCE/ObjectName)[1]', 'varchar(100)') as objectName
, eventData().value('(/EVENT_INSTANCE/ObjectType)[1]', 'varchar(100)') as objectType
, eventData().value('(/EVENT_INSTANCE/LoginName)[1]', 'varchar(100)') as LoginName
, eventData().value('(/EVENT_INSTANCE/EventType)[1]', 'varchar(100)') as eventType
END

END
END TRY
BEGIN CATCH
BEGIN
declare @html varchar(max)

select @html = '<html>' + getDate() + '</br>' + eventData().value('(/EVENT_INSTANCE/ObjectName)[1]', 'varchar(100)')
+ '</br>' + ERROR_MESSAGE() + '</html>'

PRINT 'Warning: Unable to submit change to audit'
SELECT ERROR_MESSAGE()

exec util_EmailOut_DatabaseMail_prc @from = '<address>',
@to = '<address>',
@cc = null,
@bcc = null,
@subject = 'Change Tracking Insert Failure',
@body = null,
@HTMLBody = @html,
@importance = 1,
@file = null
END
END CATCH




GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
ENABLE TRIGGER DDL_changeTracking_tr ON DATABASE





It inserts the trigger data into:



Code Block

CREATE TABLE audit_tbl (
databaseId int not null,
--auditTime datetime default getDate() not null,
auditTime datetime not null,
loginName varchar(255) not null,
objectName varchar(255) not null,
objectType varchar(25) not null,
eventType varchar(40) not null
)
go
ALTER TABLE audit_tbl ADD CONSTRAINT PK_audit_tbl_databaseId_auditTime_objectName PRIMARY KEY (databaseId, objectName, auditTime)
CREATE NONCLUSTERED INDEX IX_audit_tbl_auditTime_loginName ON audit_tbl(auditTime, loginName)
CREATE NONCLUSTERED INDEX IX_audit_tbl_auditTime_objectType ON audit_tbl(auditTime, objectType)





In the same database that I've run this one, I'm running this code to test it:



Code Block

create procedure cow_prc
as select 1
go
drop procedure cow_prc
Occassionally when I run this, I get the following error:
Msg 241, Level 16, State 1, Procedure DDL_changeTracking_tr, Line 42
Conversion failed when converting datetime from character string.


I am completely lost on this. I've had 3 fellow DBAs look at it and they're not sure what's going on with it. I've even tried writing the trigger logic as a CTE which using isDate() to make sure that auditTime actually is a date.

Any insight would be greatly appreciated. Thanks in advance.

View 6 Replies View Related

Send Mail Task In SSIS Weird Errors

Aug 31, 2006

Hey there all,



i am having a weird problem with the send mail task in SSIS. I have tried to different things, and i end up with two different errors:



Firstly, i have setup a data dump to excel, and the send mail taks emails this to specific email addresses.

In the Send mail task i have validated to SMTP server, and its correct.

I have manually entered all the information in the Send mail task, and i am sending to multiple email addresses. These are all seperated by a semi colan. I run the task and it fails on the send mail task with the follwoing error:

Error: 0xC002F304 at Send Mail Task, Send Mail Task: An error occurred with the following error message: "Unable to send to all recipients.".

Task failed: Send Mail Task

I have validated all the email address and they are correct. I did some searching and someone suggested to replace the semi colan with a comma. I do this and i get the follwoing error"

Error: 0xC002F304 at Send Mail Task, Send Mail Task: An error occurred with the following error message: "Mailbox unavailable. The server response was: 5.7.1 Unable to relay for rpwallis@bigpond.com.au".

I have checked that the IP for the SQL server is on the list of allowed relays on our exchange server. Does it make a difference if i am running this from Visual studio on my laptop?? by this, does it pick up the ip of my laptop when i test this or does it use the ip address of the server?? This would explain the relay message error if so..



Could someone please explain if i should use comma's or semi colans to seperate email addresses? and also lead me in the right direction in relatio to my problems..



Many thanks in advance



Scott Lancaster

View 3 Replies View Related

Cannot Insert Explicit Value For Identity Column In Table 'SS_Messeges' When IDENTITY_INSERT Is Set To OFF

Dec 21, 2007

 I use SQLExpress2005 and I search about this problem , this is a BUG in MsSql 2000 but I use sql Express 2005.although  in my  table I set IDENTITY_INSERT on (master Key)Please help me

View 5 Replies View Related

Cannot Insert Explicit Value For Identity Column In Table 'Gallery' When IDENTITY_INSERT Is Set To OFF.?

Feb 5, 2006

Hello!

Do anybody know how to fix this error?


Cannot insert explicit value for identity column in table 'Gallery' when IDENTITY_INSERT is set to OFF.?

Thanks!
Varcar!

View 1 Replies View Related

Weird INSERT INTO SELECT Results

May 20, 2006

Hi all,

I am having a weird problem occur when trying to insert missing records based on an INSERT INTO...SELECT statement.

Basically, I am populating a temporary table with data, then inserting into a main table those records from the temporary table that aren't in the main table. In addition, I am updating those records that are in the main table.

When I call the following SQL, all of the records from the temporary table are inserted even though those records already exist. Bizzarrely the update statement works perfectly.

INSERT INTO
AffiliateCategories (Identifier, AffiliateID, NetworkID, AffiliateCategoryName, NetworkCategoryName)
SELECT
Identifier,
AffiliateID,
1,
AffiliateCategoryName,
NetworkCategoryName
FROM
#TempTradeDoublerCategories
WHERE
#TempTradeDoublerCategories.AffiliateCategoryName NOT IN
(
SELECT
AffiliateCategoryName
FROM
AffiliateCategories
)


I am not sure why it is doing this and it's driving me crazy. If anyone has any ideas why this is happening, or knows of a better way to accomplish this then please let me know.

Are there some issues with string comparisons going on here?

The table that populates the temp table is defined as:

CREATE TABLE [dbo].[Staging_TradeDoubler_Categories](
    [id] [int] NULL,
    [name] [nvarchar](255) COLLATE Latin1_General_CI_AS NULL,
    [merchantName] [nvarchar](255) COLLATE Latin1_General_CI_AS NULL,
    [TDCategories_Id] [int] NULL,
    [AffiliateID] [int] NULL
) ON [PRIMARY]


Full code listing:

IF OBJECT_ID('tempdb..#TempTradeDoublerCategories') IS NOT NULL
DROP TABLE #TempTradeDoublerCategories

CREATE TABLE #TempTradeDoublerCategories
(
Identifier INT,
AffiliateID INT,
AffiliateCategoryName VARCHAR(255),
NetworkCategoryName VARCHAR(255)
)



INSERT INTO
#TempTradeDoublerCategories (AffiliateCategoryName)
SELECT DISTINCT
CAST(merchantName AS VARCHAR(255)) AS MerchantName
FROM
Staging_TradeDoubler_Categories
ORDER BY
MerchantName



UPDATE
#TempTradeDoublerCategories
SET
#TempTradeDoublerCategories.Identifier = Staging_TradeDoubler_Categories.id,
#TempTradeDoublerCategories.AffiliateID = Staging_TradeDoubler_Categories.AffiliateID,
#TempTradeDoublerCategories.NetworkCategoryName = Staging_TradeDoubler_Categories.[name]
FROM
Staging_TradeDoubler_Categories
WHERE
Staging_TradeDoubler_Categories.merchantName = #TempTradeDoublerCategories.AffiliateCategoryName



UPDATE
#TempTradeDoublerCategories
SET
#TempTradeDoublerCategories.AffiliateID = Staging_TradeDoubler_Affiliates.AffiliateID
FROM
Staging_TradeDoubler_Affiliates
WHERE
#TempTradeDoublerCategories.AffiliateID = Staging_TradeDoubler_Affiliates.TradeDoublerAffiliateID

Print 'Inserting records'

INSERT INTO
AffiliateCategories (Identifier, AffiliateID, NetworkID, AffiliateCategoryName, NetworkCategoryName)
SELECT
Identifier,
AffiliateID,
1,
AffiliateCategoryName,
NetworkCategoryName
FROM
#TempTradeDoublerCategories
WHERE
#TempTradeDoublerCategories.AffiliateCategoryName NOT IN
(
SELECT
AffiliateCategoryName
FROM
AffiliateCategories
)

Print 'Updating records'

UPDATE
AffiliateCategories
SET
AffiliateCategories.AffiliateCategoryName = #TempTradeDoublerCategories.AffiliateCategoryName,
AffiliateCategories.NetworkCategoryName = #TempTradeDoublerCategories.NetworkCategoryName,
DateModified = GETDATE()
FROM
#TempTradeDoublerCategories
WHERE
#TempTradeDoublerCategories.AffiliateCategoryName IN
(
SELECT
AffiliateCategories.AffiliateCategoryName
FROM
AffiliateCategories
)



PRINT 'Dropping table'


IF OBJECT_ID('tempdb..#TempTradeDoublerCategories') IS NOT NULL
DROP TABLE #TempTradeDoublerCategories

View 1 Replies View Related

Insert Or Update Errors

May 1, 2007

Is there a way I can stop a form from inserting or updating a record when there is an error.  I have an sql 2000 DB.  I have noticed that if the db field can handle 50 characters and the form field has no limit on the number of characters no errors are displayed to the user if they try to use more than the 50 characters in the textbox.  The record is not saved.  None of the fields are saved. I do notice the autonumber generated is skipped by the db.  That is, the next autonumber for a successful insert skips the logical next number.   How do I capture this error, or any save error and return the user back to the form?  Yes, I have limited the number of characters a user can type on the textbox now, but I would really like to catch save or insert errors.  I use asp.net 2.0 and VB.  I don't know C#. thanksMilton

View 5 Replies View Related

Sqldatasource INSERT Commander Errors

Sep 4, 2006

Ok, when i use a sqldatasource control and build a INSERT command like below.  My code always gives me a already have @UserId parameter error when I try to insert.  What am I doing wrong here? SqlDataSource INSERT COMMAND:INSERT INTO Ranger_Profile(UserId, FirstName, LastName, Address, City, State, Zip, HomePhone, CellPhone, Email) VALUES (@UserId, @FirstName, @LastName, @Address, @City, @State, @Zip, @HomePhone, @CellPhone, @Email)Page Code:Dim RangerProfileDataSource As SqlDataSource = SqlDataSource1RangerProfileDataSource.InsertParameters.Add("UserId", CreateNewUser.UserName.ToString)RangerProfileDataSource.InsertParameters.Add("FirstName", txtFirstName.Text.ToString)RangerProfileDataSource.InsertParameters.Add("LastName", txtLastName.Text.ToString)RangerProfileDataSource.InsertParameters.Add("Address", txtAddress.Text.ToString)RangerProfileDataSource.InsertParameters.Add("City", txtCity.Text.ToString)RangerProfileDataSource.InsertParameters.Add("State", txtState.Text.ToString)RangerProfileDataSource.InsertParameters.Add("Zip", txtZip.Text.ToString)RangerProfileDataSource.InsertParameters.Add("HomePhone", txtHomePhone.Text.ToString)RangerProfileDataSource.InsertParameters.Add("CellPhone", txtCellPhone.Text.ToString)RangerProfileDataSource.InsertParameters.Add("Email", CreateNewUser.Email.ToString)Dim rowsaffected As Integer = SqlDataSource1.InsertIf rowsaffected = 0 Then'End If

View 4 Replies View Related

Numeric Overflow . No Errors. Insert The Wrong Number

Jul 23, 2005

Hi,I have a field: usercode [tinyint]In Query Analyzer:UPDATE tblUserProcessSET usercode = 1002Result: Error "Arithmetic overflow error for data type tinyint, value = 1002.The statement has been terminated."In VBA/Access ( linked to SQL Server ):intOptions = 512pstrQuerySQL = "UPDATE ..."CurrentDb.Execute pstrQuerySQL, intOptionsResult: no errors, insert value 223 (???)Why?Thanks, Eugene

View 6 Replies View Related

Is There A Way To Capture All Bulk Insert Errors From Within A Stored Procedure?

Sep 28, 2007

Hi all!!

I have a stored procedure that dynamically bulk loads several tables from several text files. If I encounter an error bulk loading a table in the stored procedure, all I get is the last error code produced, but if I run the actual bulk load commands through SQL Management Studio, it gives much more usable errors, which can include the column that failed to load. We have tables that exceed 150 columns (don't ask), and having this information cuts troubleshooting load errors from hours down to minutes. Onto my question..., is there any way to capture all of the errors produced by the bulk load from within a stored procedure (see examples below)?


Running this...


BULK INSERT Customers

FROM 'c: estcustomers.txt'

WITH (TabLock, MaxErrors = 0, ErrorFile = 'c: estcustomers.txt.err')


Produces this (notice column name at the end of the first error)...


Msg 4864, Level 16, State 1, Line 1

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 1 (CustId).

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7330, Level 16, State 2, Line 1

Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".




Running this (similar to code in my stored procedure)...


BEGIN TRY

BULK INSERT Customers

FROM 'c: estcustomers.txt'

WITH (TabLock, MaxErrors = 0, ErrorFile = 'c: estcustomers.txt.err')

END TRY

BEGIN CATCH

SELECT

ERROR_NUMBER() AS ErrorNumber,

ERROR_SEVERITY() AS ErrorSeverity,

ERROR_STATE() AS ErrorState,

ERROR_PROCEDURE() AS ErrorProcedure,

ERROR_LINE() AS ErrorLine,

ERROR_MESSAGE() AS ErrorMessage;

END CATCH



Produces something similar to this (which is useless)...
...Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

View 3 Replies View Related

Inconsistent Errors Using Bulk Insert With A Format File

May 16, 2006

As part of a c# program, utilizing .Net 2.0, I am calling a sproc via a SqlCommand to bulk load data from flat files to a various tables in a SQL Server 2005 database. We are using format files to do this, as all of the incoming flat files are fixed length. The sproc simply calls a T-SQL BULK INSERT statement, accepting the file name, format file name and the database table as input paramaters. As expected, this works most of the time, but periodically (to often for a production environment), the insert fails. The particular file to fail is essentially random and when I rerun the process, the insert completes successfully.
A sample of the error messages returned is as follows (@sql is the string executed):
Cannot bulk load. Invalid destination table column number for source column 1 in the format file "\RASDMNTTRAS_ROOTBCP_Format_FilesEMODT3.fmt".
Starting spRAS_BulkInsertData.
@sql = BULK INSERT Raser.dbo.EMODT3_Work FROM '\RASDMNTTRAS_ROOTAmeriHealthworkpdclmsemodt3.20060511.0915.txt.DATA' WITH (FORMATFILE = '\RASDMNTTRAS_ROOTBCP_Format_FilesEMODT3.fmt');

The format file for this particular example is as follows (I apologize for the length):
8.0
62
1 SQLCHAR 0 1 "" 1 Record_Type SQL_Latin1_General_CP1_CI_AS
2 SQLCHAR 0 15 "" 2 Vendor_Number SQL_Latin1_General_CP1_CI_AS
3 SQLCHAR 0 20 "" 3 Extract_Subscriber_Number SQL_Latin1_General_CP1_CI_AS
4 SQLCHAR 0 20 "" 4 Extract_Member_Number SQL_Latin1_General_CP1_CI_AS
5 SQLCHAR 0 2 "" 5 Claim_Nbr_Branch_Code SQL_Latin1_General_CP1_CI_AS
6 SQLCHAR 0 8 "" 6 Claim_Nbr_Batch_Date_CCYYMMDD SQL_Latin1_General_CP1_CI_AS
7 SQLCHAR 0 3 "" 7 Claim_Nbr_Batch_Sequence_Nbr SQL_Latin1_General_CP1_CI_AS
8 SQLCHAR 0 3 "" 8 Claim_Nbr_Sequence_Number SQL_Latin1_General_CP1_CI_AS
9 SQLCHAR 0 3 "" 9 LINE_NUMBER SQL_Latin1_General_CP1_CI_AS
10 SQLCHAR 0 1 "" 10 Patient_Sex_Code SQL_Latin1_General_CP1_CI_AS
11 SQLCHAR 0 3 "" 11 Patient_Age SQL_Latin1_General_CP1_CI_AS
12 SQLCHAR 0 4 "" 12 G_L_Posting_Tables_Code SQL_Latin1_General_CP1_CI_AS
13 SQLCHAR 0 50 "" 13 G_L_Posting_Tbls_Code_Desc SQL_Latin1_General_CP1_CI_AS
14 SQLCHAR 0 2 "" 14 Fund_TYPE SQL_Latin1_General_CP1_CI_AS
15 SQLCHAR 0 1 "" 15 Stop_Loss_Or_Step_Down_Code SQL_Latin1_General_CP1_CI_AS
16 SQLCHAR 0 2 "" 16 Stop_Loss_Fund SQL_Latin1_General_CP1_CI_AS
17 SQLCHAR 0 50 "" 17 Stop_Loss_Fund_Desc SQL_Latin1_General_CP1_CI_AS
18 SQLCHAR 0 8 "" 18 Post_Date SQL_Latin1_General_CP1_CI_AS
19 SQLCHAR 0 1 "" 19 Rebundling_Status_Indicator SQL_Latin1_General_CP1_CI_AS
20 SQLCHAR 0 8 "" 20 Co_Payment_Grouper SQL_Latin1_General_CP1_CI_AS
21 SQLCHAR 0 50 "" 21 Co_Payment_Grouper_Desc SQL_Latin1_General_CP1_CI_AS
22 SQLCHAR 0 8 "" 22 Co_Payment_Accumulator SQL_Latin1_General_CP1_CI_AS
23 SQLCHAR 0 50 "" 23 Co_Payment_Accumulator_Desc SQL_Latin1_General_CP1_CI_AS
24 SQLCHAR 0 8 "" 24 Co_Insurance_Grouper SQL_Latin1_General_CP1_CI_AS
25 SQLCHAR 0 50 "" 25 Co_Insurance_Grouper_Desc SQL_Latin1_General_CP1_CI_AS
26 SQLCHAR 0 8 "" 26 Co_Insurance_Accumulator SQL_Latin1_General_CP1_CI_AS
27 SQLCHAR 0 50 "" 27 CI_Accumulator_Desc SQL_Latin1_General_CP1_CI_AS
28 SQLCHAR 0 8 "" 28 Coverage_Grouper SQL_Latin1_General_CP1_CI_AS
29 SQLCHAR 0 50 "" 29 Coverage_Grouper_Desc SQL_Latin1_General_CP1_CI_AS
30 SQLCHAR 0 8 "" 30 Coverage_Accumulator SQL_Latin1_General_CP1_CI_AS
31 SQLCHAR 0 50 "" 31 Coverage_Accumulator_Desc SQL_Latin1_General_CP1_CI_AS
32 SQLCHAR 0 8 "" 32 Deductible_Grouper SQL_Latin1_General_CP1_CI_AS
33 SQLCHAR 0 50 "" 33 Deductible_Grouper_Desc SQL_Latin1_General_CP1_CI_AS
34 SQLCHAR 0 8 "" 34 Deductible_Accumulator SQL_Latin1_General_CP1_CI_AS
35 SQLCHAR 0 50 "" 35 Deductible_Accumulator_Desc SQL_Latin1_General_CP1_CI_AS
36 SQLCHAR 0 8 "" 36 Unit_Grouper SQL_Latin1_General_CP1_CI_AS
37 SQLCHAR 0 50 "" 37 Unit_Grouper_Desc SQL_Latin1_General_CP1_CI_AS
38 SQLCHAR 0 8 "" 38 Unit_Accumulator SQL_Latin1_General_CP1_CI_AS
39 SQLCHAR 0 50 "" 39 Unit_Accumulator_Desc SQL_Latin1_General_CP1_CI_AS
40 SQLCHAR 0 8 "" 40 Out_Of_Pocket_Grouper SQL_Latin1_General_CP1_CI_AS
41 SQLCHAR 0 50 "" 41 Out_Of_Pocket_Grouper_Desc SQL_Latin1_General_CP1_CI_AS
42 SQLCHAR 0 8 "" 42 Out_Of_Pocket_Accumulator SQL_Latin1_General_CP1_CI_AS
43 SQLCHAR 0 50 "" 43 Out_Of_Pocket_Acc_Desc SQL_Latin1_General_CP1_CI_AS
44 SQLCHAR 0 3 "" 44 Service_Edit_Code SQL_Latin1_General_CP1_CI_AS
45 SQLCHAR 0 50 "" 45 Service_Edit_Code_Desc SQL_Latin1_General_CP1_CI_AS
46 SQLCHAR 0 8 "" 46 System_Date_MEDMAS_CCYYMMDD SQL_Latin1_General_CP1_CI_AS
47 SQLCHAR 0 8 "" 47 Last_Change_MEDMAS_CCYYMMDD SQL_Latin1_General_CP1_CI_AS
48 SQLCHAR 0 10 "" 48 Medicare_Termination_Reason_Code SQL_Latin1_General_CP1_CI_AS
49 SQLCHAR 0 10 "" 49 User_ID_MEDMAS SQL_Latin1_General_CP1_CI_AS
50 SQLCHAR 0 10 "" 50 User_ID_Last_Modified SQL_Latin1_General_CP1_CI_AS
51 SQLCHAR 0 8 "" 51 Adjudication_Date_CCYYMMDD SQL_Latin1_General_CP1_CI_AS
52 SQLCHAR 0 9 "" 52 Adjudication_Time SQL_Latin1_General_CP1_CI_AS
53 SQLCHAR 0 10 "" 53 Adjudication_User_ID SQL_Latin1_General_CP1_CI_AS
54 SQLCHAR 0 9 "" 54 A_P_Batch_Number SQL_Latin1_General_CP1_CI_AS
55 SQLCHAR 0 7 "" 55 A_P_Sequence SQL_Latin1_General_CP1_CI_AS
56 SQLCHAR 0 3 "" 56 CPA_Batch_Number SQL_Latin1_General_CP1_CI_AS
57 SQLCHAR 0 8 "" 57 CPA_Date_CCYYMMDD SQL_Latin1_General_CP1_CI_AS
58 SQLCHAR 0 1 "" 58 Manual_Authorization_Flag SQL_Latin1_General_CP1_CI_AS
59 SQLCHAR 0 50 "" 59 Fund_Description SQL_Latin1_General_CP1_CI_AS
60 SQLCHAR 0 1 "" 60 DRG_Inclusion_Indicator SQL_Latin1_General_CP1_CI_AS
61 SQLCHAR 0 1 "" 61 Future_Expansion SQL_Latin1_General_CP1_CI_AS
62 SQLCHAR 0 2 "
" 62 Company_Number SQL_Latin1_General_CP1_CI_AS



Has anyboy run across this before, or have any ideas as to what might be happening?
Thanks in advance.

View 6 Replies View Related

IDENTITY_INSERT Is Set To OFF

Dec 5, 2005

I am trying to insert a new record to a table in my application created by VWD Express. I get beack the responce "Cannot insert explicit value for identity column in table 'Tradersa' when IDENTITY_INSERT is set to OFF" . I have a key record in the table which I would like to increment automatically as I add records so I have set the is identity value to true and both the identity seed and increment to 1.
I have done a fair bit or searching but do not know how to set the table value of IDENTITY_INSERT to ON. Is this as the table is set up or as the record is about to be added? I beleive I should set this when I add the record, but do not know how to in VWD.
Any help would be most welcome. Many thanks in advance

View 4 Replies View Related

Set Identity_insert

Apr 23, 2001

Hi
--SQL SERVER 7.0
I have a table P1 which has one identity column and 9 other columns.
i need to put all the data from this table into another table with same structure as P1 called P2.

even though i used Set identity_insert P2 on
I get an error saying column list must be specified
Basically i was trying to do this

SET IDENTITY_INSERT P2 ON
go
insert into P2
select * from P1

could somebody throw light onto how to specify the column list,but at the same time inserting the entire data from P1 in one shot(using select * from...)?

Any help ragarding this is highly appreciated
Thanx
SK

View 2 Replies View Related

SET IDENTITY_INSERT

Mar 17, 2000

The SQL Server 7 documentation says "SET IDENTITY_INSERT permissions default to all users".

I run this command:

SET IDENTITY_INSERT database.dbo.tablename ON

I am getting an error

Server: Msg 8104, Level 16, State 1, Line 1
The current user is not the database or object owner of table

1) Is this an error in the documentation?

2) If so, is there a way I can grant rights to a non-dbo account to perform this?

Thanks

View 1 Replies View Related

Identity_insert?

Nov 11, 2007

I need to archive from one table to another but the new table, which is a duplicate of the old one, won't allow inserts into the ID column.
I am using:
set identity_insert soldVehicles on
INSERT INTO soldVehicles
SELECT *
FROM vehicles
Where sent2sold = 'yes'
but I get this error:
Error -2147217900


An explicit value for the identity column in table 'soldVehicles' can only be specified when a column list is used and IDENTITY_INSERT is ON.

set identity_insert soldVehicles on
INSERT INTO soldVehicles
SELECT *
FROM vehicles
Where sent2sold = 'yes'

As I have turned ID_insert ON it must be the column list?...
not sure what to do next.

View 14 Replies View Related

Set Identity_insert

Dec 24, 2007

hi

i need to set the identity_insert on and off to a remote table in order to insert rows into it

can anyone help me please

View 11 Replies View Related

Identity_insert

Aug 28, 2006

my SP worked on friday, then today i ran it, but it's not working and throws these errors. i googled the error, but i still can't fix it. can you help me?


Server: Msg 8101, Level 16, State 1, Procedure USP_Trio_Popul_Stg_Tbls, Line 31
An explicit value for the identity column in table 'dbo.Name_Pharse_Stg_Tbl2' can only be specified when a column list is used and IDENTITY_INSERT is ON.
Server: Msg 8101, Level 16, State 1, Procedure USP_Trio_Popul_Stg_Tbls, Line 57
An explicit value for the identity column in table 'dbo.Name_Pharse_Stg_Tbl3' can only be specified when a column list is used and IDENTITY_INSERT is ON.

View 4 Replies View Related

IDENTITY_INSERT

Mar 31, 2008

I have 2 databases, HS and BoardAnalyst and the table TCompanies exist in both. I want to delete all of the records from HS.TCompanies and repopulate it with data from BoardAnalyst.TCompanies. I'm getting the error message "Table 'HS.dbo.CompID' does not exist or cannot be opened for SET operation." CompID is the PK for the table. I'm not sure what the problem is. Thanks



DELETE FROM HS.dbo.TCompanies
GO

SET IDENTITY_INSERT HS.dbo.TCompanies ON
GO

INSERT INTO HS.dbo.TCompanies
(
HS.dbo.AnnualMtg,
HS.dbo.BdMtgs,
HS.dbo.CompanyName,
HS.dbo.CompID,
HS.dbo.DirectorsTotal,
HS.dbo.Exchange,
HS.dbo.IndexFortune,
HS.dbo.Industry,
HS.dbo.LinkComp,
HS.dbo.MailAddress,
HS.dbo.MailCity,
HS.dbo.MailCountry,
HS.dbo.MailFax,
HS.dbo.MailingAddress1a,
HS.dbo.MailingAddress2,
HS.dbo.MailPhone,
HS.dbo.MailPostCode,
HS.dbo.MailState,
HS.dbo.MarketCap,
HS.dbo.ProxyDate,
HS.dbo.Revenues,
HS.dbo.StateHQ,
HS.dbo.Ticker,
HS.dbo.Updated
)

SELECT
BoardAnalyst.dbo.TCompanies.AnnualMtg,
BoardAnalyst.dbo.TCompanies.BdMtgs,
BoardAnalyst.dbo.TCompanies.CompanyName,
BoardAnalyst.dbo.TCompanies.CompID,
BoardAnalyst.dbo.TCompanies.DirectorsTotal,
BoardAnalyst.dbo.TCompanies.Exchange,
BoardAnalyst.dbo.TCompanies.IndexFortune,
BoardAnalyst.dbo.TCompanies.Industry,
BoardAnalyst.dbo.TCompanies.LinkComp,
BoardAnalyst.dbo.TCompanies.MailAddress,
BoardAnalyst.dbo.TCompanies.MailCity,
BoardAnalyst.dbo.TCompanies.MailCountry,
BoardAnalyst.dbo.TCompanies.MailFax,
BoardAnalyst.dbo.TCompanies.MailingAddress1a,
BoardAnalyst.dbo.TCompanies.MailingAddress2,
BoardAnalyst.dbo.TCompanies.MailPhone,
BoardAnalyst.dbo.TCompanies.MailPostCode,
BoardAnalyst.dbo.TCompanies.MailState,
BoardAnalyst.dbo.TCompanies.MarketCap,
BoardAnalyst.dbo.TCompanies.ProxyDate,
BoardAnalyst.dbo.TCompanies.Revenues,
BoardAnalyst.dbo.TCompanies.StateHQ,
BoardAnalyst.dbo.TCompanies.Ticker,
BoardAnalyst.dbo.TCompanies.Updated
FROM
BoardAnalyst.dbo.TCompanies
GO


SET IDENTITY_INSERT HS.dbo.CompID OFF
GO

View 1 Replies View Related

IDENTITY_INSERT

Apr 23, 2008



I have a table where IDENTITY_INSERT is set to OFF. I also have one stored procedure that I need to run that requires IDENTITY_INSERT to be set to ON. The only problem is the users who run the stored procedure are not owners of the table and are getting the error "The current user is not the database or object owner of table ... Cannot perform SET IDENTITY_INSERT" Is there a way to use the IDENTITY_INSERT command without being the owner of the object?

View 5 Replies View Related

SET IDENTITY_INSERT For SQL CE And SQL ME

Sep 30, 2007



Hi,

I have Product table in SQL Server 2005 with Primary key ProductID. This is column with Identity set so the values for this column is auto-generated. I also have Orders table has a key that is foreign key to table Products. Now my dev environment has SQL ME whereas the deployment will be done on SQL CE.

Now I have a requirement where we want to synchronize the master tables from SQL Server with the device. For this we want to have the same identity values on the device. When I try to issue SET IDENTITY_INSERT Products ON on SQL ME it does not work. Is there any way I can set the identity ON on the SQL Mobile Edition?

Also another question I have is: Is SET IDENTITY_INSERT supported on SQL Compact Edition?

Regards,
vnj

View 3 Replies View Related

SET IDENTITY_INSERT

Mar 24, 2006

We have created an "AdminUser" with the bare minimum rights for the activites it will need to do. One thing the "AdminUser" will need to do is a "SET IDENTITY_INSERT ON/OFF".

I understand that for this user to be able to do this they will need ddl_admin rights. But that gives them all kinds of permission that I don't want this user to have.

Is there a specific permission I can give the user so they can do the "IDENTITY_INSERT"?

I tried "GRANT create table to AdminUser" but that didn't work. I tried "GRANT alter any database DDL trigger to AdminUser" but that didn't work either. I'm looking for something more specific than "ddl_admin".

Thanks.

Trish

View 5 Replies View Related

When IDENTITY_INSERT Is Set To OFF. -- LINQ

Jan 21, 2008

I'm new to ASP/VS/Linq and I'm having a small problem.
 I have one table setup in SQL Server Express 2005 through Visual Studio 2008.  The table name is "Users" and has three columns (accountID, userName, email).  AccountID is the primary key and set to auto incriment.  I've added a couple of records by hand and it works.
I have a single form with a button, a label, and two text boxes.  The button code is below.  After entering some fake data that does not already exist in the database and clicking the button I get this.
Cannot insert explicit value for identity column in table 'Users' when IDENTITY_INSERT is set to OFF.
I understand that it is trying to insert something into the accountID field but I don't understand why since I'm only providing a username and e-mail address to insert.
Your help is greatly appreciated.protected void Button1_Click(object sender, EventArgs e)
{
MyDatabaseDataContext db = new MyDatabaseDataContext();
var query = from u in db.Users
where u.email == txtEmail.Text
select u;

var count = query.Count();
if (count == 0)
{
//Create a new user object.
User newUser = new User();

newUser.username = txtUsername.Text;
newUser.email = txtEmail.Text;

//Add the user to the User table.
db.Users.InsertOnSubmit(newUser);
db.SubmitChanges();
}
else
{
Label1.Text = txtEmail.Text + " already exists in the database.";

 

View 6 Replies View Related

Error : IDENTITY_INSERT Is Set To OFF !

Mar 30, 2008

Hi,
What is this error ? 
Error : " Cannot insert explicit value for identity column in table 'Comments' when IDENTITY_INSERT is set to OFF. "
Please help me .

View 2 Replies View Related

Turning IDENTITY_INSERT ON

Aug 22, 2001

Im trying to do an INSERT SELECT statement in the following manner:

INSERT INTO
DB1.dbo.TABLE
SELECT *
FROM dbo.TABLE1
dbo.TABLE2 ON dbo.TABLE1.column = dbo.TABLE2.column

And Im given this error message:

An explicit value for the identity column in table 'DB1.dbo.TABLE' can only be specified when a column list is used and IDENTITY_INSERT is ON


So if anyone knows how to turn it on it would be a great help.

Sincerely,
Matt

View 3 Replies View Related

SET IDENTITY_INSERT ON/OFF Error

Mar 22, 2007

I would like to insert an indentity column explicitly following error occurs:

Server: Msg 544, Level 16, State 1, Line 1
Cannot insert explicit value for identity column in table 'TableMarket' when IDENTITY_INSERT is set to OFF.

And when I am trying to SET IDENTITY_INSERT ON, it gives following error:

Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'ON'.

Anyone can help me please?

P.S. I am working on SQL Server 2000

Thanks,
Riaz

View 1 Replies View Related

Setting The IDENTITY_INSERT

Feb 23, 2004

is there any way i can set IDENTITY_INSERT = ON
permenately for the whole DB

View 2 Replies View Related

Identity_Insert Error

Apr 21, 2008

Hi all. This is my first post to these forums and I am a newbie. I am using SQL server 2005 and I have written a procedure to insert the data in new row. My procedure runs and executes well, but does not insert a record in my DB table. Instead I get a message in the debugger window that I need to turn ON the Identity Insert property for the tables. But after searching for a while in the IDE, I could not find any such property. So I need to know what went wrong here. Also, I am using ASP.NET to connect to the database and I found out an article on web explaining the way to set the property to ON through my ASP.NET application. But, I would also like to know how to set that property to ON through SQL management studio. Also, my primary key is not null; I am also passing the primary key value and it is unique. Please let me know a remedy for this.



Thank you.

View 15 Replies View Related

Problem With SET IDENTITY_INSERT

Sep 10, 2007

Hi,
I am facing problem while inserting data in a table having identity seed.

DECLARE @varSQL VARCHAR(8000)
DECLARE @VARe VARCHAR(400)

SET @VARe = 'Tmp_r429_sig'
SET @varSQL ='SET IDENTITY_INSERT ' + @VARe + ' ON'
EXEC (@varSQL)

INSERT INTO Tmp_r429_sig ([NAME],ID) VALUES('test',1)

SET @varSQL ='SET IDENTITY_INSERT ' + @VARe + ' OFF'
EXEC (@varSQL)

The table name need to be a variable.

I ma getting following error:
Server: Msg 544, Level 16, State 1, Line 1
Cannot insert explicit value for identity column in table 'Tmp_r429_sig' when IDENTITY_INSERT is set to OFF.

Can someone throw some light on how to execute SET IDENTITY_INSERT as a dynamic query.

View 3 Replies View Related

Problems With IDENTITY_INSERT

Mar 27, 2008

Hey Everyone,

I'm trying to copy the data from one table to another while preserving the identity keys, but I can't seem to get past this error message. Here's the SQL:

SET IDENTITY_INSERT dbo.Cms_MenuItems_Preview ON

INSERT INTO dbo.Cms_MenuItems_Preview
SELECT Id, [Name], Url, Parent, IsActive, SortIndex
FROM dbo.Cms_MenuItems

SET IDENTITY_INSERT dbo.Cms_MenuItems_Preview OFF


and the error message is:
Msg 8101, Level 16, State 1, Line 3
An explicit value for the identity column in table 'dbo.Cms_MenuItems_Preview' can only be specified when a column list is used and IDENTITY_INSERT is ON.

Any suggestions?

Thanks in advance!

View 3 Replies View Related

IDENTITY_INSERT Problem

Jul 20, 2005

Hi, I am having a problem with IDENTITY_INSERT command with MSDE 2000 (ADO2.8) in that I cannot insert a specific value to an identity field. (linesbelow with >>> are code lines. I am using Python, but the syntax should beabout the same as VBScript)First, I create an ADO Connection and create my table.[color=blue][color=green][color=darkred]>>> c = win32com.client.Dispatch('ADODB.Connection')[/color][/color][/color][color=blue][color=green][color=darkred]>>> dsn = 'DRIVER=SQL[/color][/color][/color]Server;UID=myID;Trusted_Connection=Yes;Network=DBM SSOCN;APP=Microsoft DataAccess Components;SERVER=SERVERINSTANCE;"'[color=blue][color=green][color=darkred]>>> c.Open(dsn)[/color][/color][/color][color=blue][color=green][color=darkred]>>> sql = 'CREATE TABLE Table_Name ('[/color][/color][/color][color=blue][color=green][color=darkred]>>> sql += 'ID_Field INTEGER PRIMARY KEY IDENTITY(1,1), '[/color][/color][/color][color=blue][color=green][color=darkred]>>> sql += 'Field_2 nchar(50) NOT NULL, '[/color][/color][/color][color=blue][color=green][color=darkred]>>> sql += 'Field_3 FLOAT DEFAULT 0.0)'[/color][/color][/color][color=blue][color=green][color=darkred]>>> c.Execute(sql)[/color][/color][/color]This works fine. Then, I attempt to allow insertion into the ID_Field.[color=blue][color=green][color=darkred]>>> c.Execute("SET IDENTITY_INSERT Table_Name ON")[/color][/color][/color]This seems to work in that it does not throw an error and gives a returnof -1. Then I open a Recordset[color=blue][color=green][color=darkred]>>> r = win32com.client.Dispatch('ADODB.Recordset')[/color][/color][/color][color=blue][color=green][color=darkred]>>> r.Open('Table_Name', c, 2, 4)[/color][/color][/color]Last, I am attempt to add a record to the recordset with an explicit ID,[color=blue][color=green][color=darkred]>>> r.AddNew()[/color][/color][/color][color=blue][color=green][color=darkred]>>> r.Fields.Item('ID_Field').Value = 45[/color][/color][/color]but this fails with the error of"Multiple-step OLE DB operation generated errors. Check each OLE DBstatus value, if available. No work was done."Even worse, if I now try to set the identity field to allow inserts again,Updating() causes an error that I must use an explicit value for ID_Field,but if I try to give it one, it fails with the above error. I have todestroy the recordset object at this point to get any further.I am told that SET IDENTITY_INSERT only remains active for one statement andthus must be combined with the insert, but I do not know how to do this.There is a similar sounding bug w/ SQL 7(http://support.microsoft.com/defaul...b;EN-US;253157), but thereis no indication that it affects newer versions of the DB. Does anyone haveany suggestions or ideas?Thanks for any help,-d

View 1 Replies View Related

Unable To Set Identity_Insert Off?

Jan 24, 2007

Hi i am unable to set Identity_insert off in sql server compact? Can you please tell me if sqlce supports or not?

If it does not support what is the work around that can be done?

Please tell the workaround in detail i mean altering table for identity key e.g. Because i have seen some posts that talk about alter table but i am unable to understand how that can done?

Thanks

View 7 Replies View Related

SET IDENTITY_INSERT Tablename ON

Sep 16, 2006

I know there has already been a thread on this, but I want to push some about it.

In SQL Server, there is a command "SET IDENTITY_INSERT tablename ON".

That allows you to update IDENTITY columns, or do INSERTs that include IDENTITY columns. Although a work-around was given for this in the other thread (reset the IDENTITY seed to the desired value before each INSERT), that is a major pain.

In my database, I have a table that tracks charitable donors. They have a donornum, that is an IDENTITY column, and a year. Together, the donornum and the year form the primary key. Each year end, a copy is made of all donor records in one year, to form the next year's donors. They have to keep the same donornum, but they get a new year value of course. Adding new donors uses the donornum normally, incrementing the IDENTITY donornum value.

The advantage of this is that you can match up one year's donors with the previous year's, by joining on donornum. But I need there to be separate records, so they can have separately updated addresses, annual pledge amounts, etc.

Is there any way the SET IDENTITY_INSERT feature can be added to SQL Everywhere, or some other approach can be found that is less laborious than the existing work-around? (The problem with it is that if you have hundreds of donors to copy, you have to do one ALTER TABLE to reset the identity seed for each donor insert for the new year.)

Thanks.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved