Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How do you find out all the IDENTITY columns of all the tables in a given database? Expand / Collapse
Author
Message
Posted Thursday, January 07, 2010 6:57 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 11:33 PM
Points: 99, Visits: 134
Plz help me!
Post #843497
Posted Thursday, January 07, 2010 7:16 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 27, 2013 11:09 PM
Points: 162, Visits: 263
SELECT * FROM syscolumns WHERE columnproperty(id,column_name,isidentity) = 1
Post #843516
Posted Thursday, January 07, 2010 7:36 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 11:33 PM
Points: 99, Visits: 134

hello sir,

here my table is ICH...

create table ich(eno int identity(3684215,1),ename varchar(10))

how to find ? tell me?

Post #843543
Posted Friday, January 08, 2010 1:23 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: 2 days ago @ 6:40 AM
Points: 3,683, Visits: 4,818
try this (written for SQL2005 / SQL2008)

select  objects.name as Object_Name, columns.name as column_name
from sys.objects
join sys.columns on columns.object_id = objects.object_id
where is_identity = 1



____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #844145
Posted Friday, January 08, 2010 5:39 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 11:33 PM
Points: 99, Visits: 134
Thank you very much sir........

i got the result.....

Your's

Subha..........
Post #844217
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse