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
 General SQL Server Forums
 New to SQL Server Programming
 Identity Function

Author  Topic 

rgoda
Starting Member

1 Post

Posted - 2010-11-18 : 03:53:16
Hi,

I am having one table tab1 in that table i am updating the column x with identity function.The last value in the column x is 100037.Now i want to update the columnn Y in the table tab2 with identity function.But the first value should be start with 100038(i.e.10037+1).Please help me in this .

Thanks in advance

Ravi

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-18 : 04:04:46
A column can be identity or not.
What do you mean when you say i am updating the column x with identity function?
What do you mean when you say Now i want to update the columnn Y in the table tab2 with identity function?

Think about what is UPDATE, what is ALTER, what is CREATE and so on.
Please be more clear - thank you.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-11-18 : 06:55:22
i think what you're asking is someting like this



DECLARE @MaxXVal int
SELECT @MaxXVal = IDENT_CURRENT('tab1')

then depending on your insert whether its batch or not you've to use above value
can you specify whether its batch inserton?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -