0

please, I want a sql query that will return the no of fields in a database as an integer

example
i have table student
columns are
regno
surname
othername


I want my result to be 3

what do i do??

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by __avd
0

Hi

Try the query like this

SELECT count(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'mytable'
0

You may use FieldCount property of DataReader or Count property of DataTable's columns collection.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.