Link to home
Start Free TrialLog in
Avatar of gvilbis
gvilbis

asked on

how do i set identity on in SQL?

i am using the following command:
insert into [wf10taa_test].[dbo].[cutdetail] select * FROM [wf10taa].[dbo].[cutdetail] where cutno = '9701373'

and i am receiving the followig error when i run it:
An explicit value for the identity column in table 'wf10taa_test.dbo.cutdetail' can only be specified when a column list is used and IDENTITY_INSERT is ON.

what i have to do to allow this line to run? and after i finish do i need to set off? how?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of JestersGrind
JestersGrind
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of James Murrell
James Murrell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gvilbis
gvilbis

ASKER

i did the following but still receiving the same error:
SET IDENTITY_INSERT [wf10taa_test].[dbo].[cutdetail] ON
go
insert into [wf10taa_test].[dbo].[cutdetail] select * FROM [wf10taa].[dbo].[cutdetail] where cutno = '9701373'
SET IDENTITY_INSERT [wf10taa_test].[dbo].[cutdetail] OFF
go


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

i must to put all the columns names? but i have many columns, is there a shortage way to do it instead to type all the columns names? it will take a long time?

Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial