How do you find out how many columns you have in a table instead of manual counting ? Thanks for your time. -Ivan
try this 2 queries: select object_id('[table_name]' <- This will return a number like this: 272004000 then type: select count(*) From syscolumns where id = [number_returned] that's it. ------------ Ivan at 4/23/01 5:07:31 PM How do you find out how many columns you have in a table instead of manual counting ? Thanks for your time. -Ivan
You can use select count(*) from syscolumns as A where a.id = object_id('TableName' this way you run the query once. Hth Hiku ------------ al at 4/23/01 5:23:12 PM try this 2 queries: select object_id('[table_name]' <- This will return a number like this: 272004000 then type: select count(*) From syscolumns where id = [number_returned] that's it. ------------ Ivan at 4/23/01 5:07:31 PM How do you find out how many columns you have in a table instead of manual counting ? Thanks for your time. -Ivan
Forum Rules