I need a query in sql to get total columns in a table.Can anybody help?
Correction to top query above, to allow to run from any database
SELECT COUNT(COLUMN_NAME) FROM [*database*].INFORMATION_SCHEMA.COLUMNS WHERE TABLE_CATALOG = 'database' AND TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'table'