By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,377 Members | 2,966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,377 IT Pros & Developers. It's quick & easy.

Column Name

P: 54
Hi,

in sql server, how to find out no. of column names in a database

eg.

comp database

in emp table
eno

in department table
eno

it return 2

Thanks,
Murugavel
May 12 '08 #1
Share this Question
Share on Google+
2 Replies


deepuv04
Expert 100+
P: 227
Hi,

in sql server, how to find out no. of column names in a database

eg.

comp database

in emp table
eno

in department table
eno

it return 2

Thanks,
Murugavel
Hi,


SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS
May 12 '08 #2

ck9663
Expert 2.5K+
P: 2,878
For number of columns for a specific table, try:

Expand|Select|Wrap|Line Numbers
  1. select count(*) from syscolumns
  2. where id in (select id from sysobjects where name = 'YourtableName')
-- CK
May 12 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.