MS SQL Tips & Tricks

How to get the body of stored procedure or view using sql query

To get the body of stored procedure using sql query you can use something like that. The same way you can access the body of a view.

SELECT OBJECT_DEFINITION(OBJECT_ID('procedure_name_here'))

or

SELECT OBJECT_DEFINITION(OBJECT_ID('view_name_here'))

to get the list of table's columns you can use query:

select it.TABLE_NAME, 
	   ic.COLUMN_NAME, 
	   ic.DATA_TYPE, 
	   isNull(CHARACTER_MAXIMUM_LENGTH,0 ) as SIZE
from INFORMATION_SCHEMA.TABLES it
inner join INFORMATION_SCHEMA.COLUMNS ic on 
	(it.TABLE_NAME = ic.TABLE_NAME) 
where it.TABLE_NAME='Employees'
order by it.TABLE_NAME

Learn more tricks

Add Comment

Comments

31st August 2021

Vademecum Cialis

Propecia

12th September 2021

cialis online purchase

AwasmaB

16th September 2021

Order Cialis In Usa

Plaquenil

16th September 2021

Cialis Taladafil

buy priligy cheap

18th September 2021

https://buylasixshop.com/ - over the counter lasix

nertoorne

19th September 2021

how to get tadalafil

NickLoalf

19th September 2021

tadalafil 10 mg canada

KimLoalf

19th September 2021

how to buy viagra in canada

SamLoalf

21st September 2021

where can i buy sildenafil viagra online australia fast delivery cialis eli lilly canada pharmacy cialis viagra online quick delivery medication tizanidine 4mg where can i buy over the counter sildenafil online viagra order india

AshLoalf