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)
 Trying to use a parameter with CREATE TABLE

Author  Topic 

owen912
Starting Member

31 Posts

Posted - 2004-10-01 : 11:09:51
I am writing a temp table to scrub data imported from a text file. I am using an IDENTITY column and want to set the seed based on a parameter (see below).

DECLARE @Seed INT

SET @Seed = ((SELECT MAX(Row_ID) FROM dbo.DestinationTable) + 1)

CREATE TABLE #DataImport
(
Row_ID DECIMAL(10,0) IDENTITY((@Seed,1),
[Remaining columns not included for brevity]
)

I keep getting syntax error message. Is this something I simply can not do, or do I have a problem with my SQL?

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-10-01 : 11:35:25
you can't use decimal and identity at the same time, use int instead... and remove the extra open parenthesis after "identity"
Go to Top of Page
   

- Advertisement -