web analytics

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

Options

codeling 1602 - 6666
@2015-12-13 11:30:42

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'; 

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com