Author |
Topic |
shobhaaradhya
Starting Member
37 Posts |
Posted - 2012-09-14 : 02:24:23
|
Hi Friends, I am trying to findout last_value for the primary key columns from identity_column object. When I execute the query for this object it saysinvalid object 'sys.identity_column'I am using sql 2005. Is this object doesnot exists in sql 2005 or is there any other way where i can findout last_value for the columns.Please help me, Very urgent,Regards,Aradhya |
|
Rimsky
Starting Member
12 Posts |
Posted - 2012-09-14 : 02:49:51
|
Aradhya,Try this:select * from sys.identity_columns |
|
|
shobhaaradhya
Starting Member
37 Posts |
Posted - 2012-09-14 : 03:20:15
|
Hi Rim, Thanks for your reply. I have already tried. But the result isInvalid object name 'sys.identity_columns'.quote: Originally posted by Rimsky Aradhya,Try this:select * from sys.identity_columns
|
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-09-14 : 03:38:10
|
Please show the output of select @@version Too old to Rock'n'Roll too young to die. |
|
|
shobhaaradhya
Starting Member
37 Posts |
Posted - 2012-09-14 : 03:46:35
|
The version it showsMicrosoft SQL Server 2000 - 8.00.2039 (Intel X86) May 3 2005 23:18:38 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 2) and the compatibility level 80Thanks,Aradhyaquote: Originally posted by webfred Please show the output of select @@version Too old to Rock'n'Roll too young to die.
|
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
shobhaaradhya
Starting Member
37 Posts |
Posted - 2012-09-14 : 05:03:20
|
Hi,How will I get the last_value in SQL SERVER 2000 from you query?Regards,Aradhyaquote: Originally posted by webfred You have stated that you are on 2005 but you are on 2000 and on 2000 it will not work.SQL SERVER 2000:select object_name(id),name from syscolumns where columnproperty(id,name,'IsIdentity')=1 SQLSERVER 2005:select object_name(object_id),name from sys.identity_columnshttp://www.databasejournal.com/features/mssql/article.php/3587906/System-Tables-and-Catalog-Views.htm Too old to Rock'n'Roll too young to die.
|
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-09-14 : 05:07:23
|
http://lmgtfy.com/?q=sql+server+2000+last+value+of+identity Too old to Rock'n'Roll too young to die. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-14 : 10:39:14
|
quote: Originally posted by shobhaaradhya Hi,How will I get the last_value in SQL SERVER 2000 from you query?Regards,Aradhyaquote: Originally posted by webfred You have stated that you are on 2005 but you are on 2000 and on 2000 it will not work.SQL SERVER 2000:select object_name(id),name from syscolumns where columnproperty(id,name,'IsIdentity')=1 SQLSERVER 2005:select object_name(object_id),name from sys.identity_columnshttp://www.databasejournal.com/features/mssql/article.php/3587906/System-Tables-and-Catalog-Views.htm Too old to Rock'n'Roll too young to die.
SELECT IDENT_CURRENT('you table name')------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|