22.3.09

HOW MANY COLUMNS in a SQL Server table

Query for the users with access rights on system tables, compatible for sql server 2000/2005 and other versions.............

select count(*) from sysobjects o join syscolumns c on o.id = c.id and o.name = 'tableName'

Query on 2005 and above for users....


select count(*) from information_schema.columns where table_catalog ='master' and table_name='venkat'

Thanks and Regards,
Venkatesan Prabu .J

No comments:

Post a Comment