Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 code for set indentiy on already extra table

Author  Topic 

yan19454
Starting Member

3 Posts

Posted - 2006-05-23 : 08:57:48
I used this select * into [HIPAA FY06] from [HIPAA] to create the new table [HIPAA FY06]. I want to write to set one field ID as IDENTITY and increment 1. Thanks.

I do not like to use the create table and insert . I think it is too much coding to creat the table and copy the data of the table.


I used
ALTER TABLE HIPAA ALTER COLUMN [ID] SET IDENTITY ( 1 , 1 )

it gave me error as
Incorrect syntax near the keyword 'SET'.
some of the data from HIPAA
ID Question

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-23 : 09:10:32
select identity(int,1,1) as id, * into [HIPAA FY06] from [HIPAA]

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-05-23 : 09:11:42
Try this:

select IDENTITY(int, 1, 1) AS MyID,
*
into [HIPAA FY06]
from [HIPAA]

Kristen
Go to Top of Page
   

- Advertisement -