I need a query in sql to get total columns in a table.Can anybody help?
Select Table_Name, Count(*) As ColumnCount
From Information_Schema.Columns
Group By Table_Name
Order By Table_Name
This code show a list of tables with a number of columns present in that table for a database.
If you want to know the number of column for a particular table in a database
then simply use where
clause e.g. where Table_Name='name_your_table'