Wednesday, September 28, 2011

How to count number of columns in a table in sql server2005


SQL Query--1:

select count(*) from information_Schema.columns where table_name='tblNew'

SQL Query--2:

select count(*) from syscolumns where id in (select id from sysobjects where sysobjects.name = 'tblNew')

No comments:

Post a Comment