September 18, 2007 at 5:38 pm
Hi,
I'm pretty new to SQL SERVER 2005 - I'm upgrading from Access projects.
I have several tables in my DB, where each one of course has an index. For some reason, when I create a new record through ASP and want to get the index created by sql server for the new record - i can't do it. I get null value back.
It happens on all tables, and thus I can never get the index value of the just created record - I didn't have this problem right after transfering from Access, and it appeared some time after that, though the code hasn't changed - so i guess the problem is in SQL SERVER and not in my code (which works fine under access).
Can anyone please help me with this one? Why doesn't it give me the index?
Thank you very much.
September 18, 2007 at 5:54 pm
To quote Inigo Montoya in The Princess Bride: You keep using that word. I do not think it means what you think it means.
I think you're talking about something other than an index in SQL Server. Are you talking about an identity column, perhaps?
September 19, 2007 at 3:23 am
uhhm... I guess so. I took the word from access world - where it is an index. but i guess in MSSQL it isn't...
So yes - I'm talking about an identity column thank you for correcting me.
September 19, 2007 at 11:22 am
No problem. I was just totally confused by your terminology.
What you want to do is set the column to be an identity column first. You can do this through the GUI or by using the ALTER TABLE/ALTER COLUMN syntax. Then you'll need to reset the identity counter by using the DBCC CHECKIDENT command. Checking in Books Online should help you with the syntax for both of those.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply