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 2005 Forums
 Transact-SQL (2005)
 Invalid object 'sys.identity_column' in sql 2005

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 says

invalid 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
Go to Top of Page

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 is

Invalid object name 'sys.identity_columns'.


quote:
Originally posted by Rimsky

Aradhya,

Try this:

select * from sys.identity_columns


Go to Top of Page

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.
Go to Top of Page

shobhaaradhya
Starting Member

37 Posts

Posted - 2012-09-14 : 03:46:35
The version it shows

Microsoft 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 80


Thanks,
Aradhya


quote:
Originally posted by webfred

Please show the output of
select @@version



Too old to Rock'n'Roll too young to die.

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-09-14 : 04:53:02
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_columns

http://www.databasejournal.com/features/mssql/article.php/3587906/System-Tables-and-Catalog-Views.htm


Too old to Rock'n'Roll too young to die.
Go to Top of Page

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,
Aradhya

quote:
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_columns

http://www.databasejournal.com/features/mssql/article.php/3587906/System-Tables-and-Catalog-Views.htm


Too old to Rock'n'Roll too young to die.

Go to Top of Page

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.
Go to Top of Page

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,
Aradhya

quote:
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_columns

http://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 MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -