Monday, May 13, 2024

SQL Server commands - To find columns from Table

 sp_help :- To get information about table and stored procedure

sp_help  'tablename'

 to get column name etc



sp_helptext  'storeprocedurename' 

will display stored procedure text 


To get Columns of table

SELECT name FROM sys.columns WHERE object_id = OBJECT_ID('tablename') 



Find table and views in database

SELECT * FROM INFORMATION_SCHEMA.TABLES 

SELECT * FROM INFORMATION_SCHEMA.VIEWS

SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS  

EXEC sp_columns 'Employees'

ref:- https://stackoverflow.com/questions/578454/useful-system-stored-procedures-in-sql-server

No comments:

Post a Comment