April 22, 2010 at 6:50 am
Dear all,
I have the following select statement:
SELECT (column_name +' '+'('+data_type+ ' '+IsNull(CAST(character_maximum_length as varchar(5)), '')+')') AS columnInfo FROM INFORMATION_SCHEMA.COLUMNS WHERE (TABLE_NAME = 'test') ORDER BY COLUMN_NAME
How can i select only the columns that are not autoincrement?
Thanks in advance.
April 22, 2010 at 7:28 am
the views from INFORMATION_SCHEMA stuff are missing a lot of info;
to get theidentity or not,i would either use the ColumnProperty() function, or select from sys.columns instead.
select * from sys.columns where is_identity=0
select object_name(id),name,columnproperty(id,colid,'IsIdentity') from syscolumns
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply