Call sp_columns to list column definition for the specified table in SQL Server Options

codeling Posts: 1089 Points: 4569
Posted: Sunday, December 13, 2015 11:30:42 AM

In SQL Server, the system-defined stored procedure sp_columns returns column information for the specified objects that can be queried in the database.

sp_columns syntax

sp_columns [ @table_name = 'Object name.' ] ,
[ @table_owner = 'The database user who created the table.' ] ,
[ @table_qualifier = 'Database name.' ] ,
[ @column_name = 'Column name.' ] ,
[ @ODBCVer = 'ODBC Version 2 or 3.' ] ;

Example

USE model;
GO
EXEC sp_columns
@table_name = 'students',
@table_owner = 'dbo'; 

 
Users browsing this topic
Guest