Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

identity insert

Status
Not open for further replies.

msalvador

Programmer
Nov 13, 2001
33
0
0
IT
I TRY TO EXECUTE THIS SCRIPT VIA QUERY ANALYZER:
GO
SET IDENTITY_INSERT [IdWare].[dbo].[CPU] ON
GO
INSERT INTO [IdWare].[dbo].[CPU]
SELECT id,ServerName,LogConsumer,WeekType,IsMaster,TransactionConsumer,null,null
FROM [IdWareOld].[dbo].[CPU]
GO
SET IDENTITY_INSERT [IdWare].[dbo].[CPU] OFF
GO

THE RESULT IS:
Server: Msg 545, Level 16, State 1, Line 1
Explicit value must be specified for identity column in table 'CPU' when IDENTITY_INSERT is set to ON.
 
I assume ur id column is the identity one. In this case
yoy have to set the value explicitly means like
3, 4 or some value. You will not be able to do a select ID

select id ( Needs an explict value like 1,3,4 etc)

See BOL

SET IDENTITY_INSERT (T-SQL)
Allows explicit values to be inserted into the identity column of a table.

 
i've 2 db's new & old that have the same table...
look ahead i must to transfert the table via sql script
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top