|
select
obj.object_id,
obj.name,
SCHEMA_NAME(obj.schema_id) as [Schema],
a.name as Assembly_Name,
am.assembly_class,
am.assembly_method,
ret_param.name as TableVariableName,
isnull(am.execute_as_principal_id,0) as execute_as_principal_id,
p.name as execute_as_principal_id_name,
am.null_on_null_input,
cast((case when obj.type='FT' then 1 else 0 end) as bit)as Is_Table_Valued
from sys.all_objects obj
join sys.assembly_modules am on am.object_id=obj.object_id
join sys.assemblies a on am.assembly_id = a.assembly_id
LEFT OUTER JOIN sys.all_parameters AS ret_param ON ret_param.object_id = obj.object_id and ret_param.is_output = 1
left join sys.database_principals p on p.principal_id = am.execute_as_principal_id
where obj.type in ('FT','FS');
select
c.object_id,
c.name,
c.column_id,
t.name as [DataType],
c.scale,
[Precision] = columnproperty(c.object_id,c.name,'Precision'),
CAST(CASE WHEN t.name IN (N'nchar', N'nvarchar') AND c.max_length <> -1 THEN c.max_length/2 ELSE c.max_length END AS int) AS [Length],
cast(0 as bit) is_sparse
from sys.columns c
join sys.all_objects o on o.object_id = c.object_id
join sys.types t on t.user_type_id = c.user_type_id
where o.type in ('FT','FS');
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
My name is Robert Kanasz and I have been working with ASP.NET, WinForms and C# for several years.
MCSD - Web Applications
MCSE - Data Platform
MCPD - ASP.NET Developer 3.5
- Web Developer 4
MCITP - Database Administrator 2008
- Database Developer 2008
MCSA - SQL Server 2012
MCTS - .NET Framework 3.5, ASP.NET Applications
- SQL Server 2008, Database Development
- SQL Server 2008, Implementation and Maintenance
- .NET Framework 4, Data Access
- .NET Framework 4, Service Communication Applications
- .NET Framework 4, Web Applications
MS - Programming in HTML5 with JavaScript and CSS3 Specialist
Open source projects:
DBScripter - Library for scripting SQL Server database objects
Please, do not forget vote