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
 SQL Server Development (2000)
 Issue with Identity function

Author  Topic 

atlachar123456
Starting Member

33 Posts

Posted - 2011-11-23 : 11:53:05
I had created a temp table with id column as identity,its giving error as incorrect syntax near '('
CREATE TABLE #temp --11182011_2
(
posid INT IDENTITY(1,1) NULL,
position SMALLINT NULL,
superId INT NULL
)
can anyone tell me where is teh error..

atlaaaaaaaa

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-11-23 : 12:16:04
I can't reproduce your error, but you'll need to use NOT NULL for posid. I've only got SQL 2005 and 2008 to test with, both error about the NULL on posid and work fine with NOT NULL on posid. I do not get an incorrect syntax on either.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-11-23 : 12:43:08
Are you sure you're executing the whole statement - and only the whole statement?
I suspect the error is not coming from this.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

atlachar123456
Starting Member

33 Posts

Posted - 2011-11-23 : 14:04:00
I am not executing only this statemnet,its just a part in my procedure
when i am executing the entire procedure for me its getting error on this line number incorrect syntax near '('

atlaaaaaaaa
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-11-23 : 16:03:56
You'll need to post the whole thing then.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-11-24 : 03:00:47
Long shot: Make sure that any existing #TEMP is dropped before you create the Sproc (to prevent delayed name resolution fouling up by virtue of #TEMP actually being present)

But I don't think that would give you "Syntax Error"
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-11-24 : 06:12:54
Maybe a missing "end" for a conditional?

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -