spo*_*ong 7 sql sql-server excel
是否有一个SQL语句将列出MS SQL Server数据库中按模式名称排序的所有表,视图和存储过程的名称?
我想从此列表生成一个Excel电子表格,其中包含以下列:schema,type(table,view,stored proc)和name.
这是你要求的:
select
s.name as [Schema],
o.type_desc as [Type],
o.name as [Name]
from
sys.all_objects o
inner join sys.schemas s on s.schema_id = o.schema_id
where
o.type in ('U', 'V', 'P') -- tables, views, and stored procedures
order by
s.name
Run Code Online (Sandbox Code Playgroud)