Thursday, March 17, 2016

MS SQL sysobject types and get the scripts of objects

select type, COUNT(type) as cnt from sys.sysobjects where type not in ('S','K','D','F','IT','SQ','')
group by type

--U -- table objects
select * from sys.sysobjects where type = 'U'

--V -- View objects
select * from sys.sysobjects where type = 'V'

--P -- Stored procedures
select * from sys.sysobjects where type = 'P'

--TF,FN -- Functions (Table Valued, Scalar Valued)
select * from sys.sysobjects where type IN ('TF','FN')

--TR -- Trigger objects
select * from sys.sysobjects where type = 'TR'


To get the object scripts,
(Except table objects)

EXEC sp_helptext 'schemaname.Tablename'

The result will be returned in multiple lines.

No comments:

Delphi Thread Example

Delphi Thread Example Threads mean a lot with the latest computer technology. They allow you to perform multiple tasks at the same time ...