SQL查询用户下的表和存储过程

SQL Server

 

查询表

 select * from dbo.sysobjects where   OBJECTPROPERTY(id, N'IsUserTable') = 1 
-- and id = object_id(N'***')

 查询过程

 select * from dbo.sysobjects where  OBJECTPROPERTY(id, N'IsProcedure') = 1 or xtype in (N'P') 

 

 查询函数

 select * from dbo.sysobjects where  xtype in (N'FN', N'IF', N'TF')  
 ---and id = object_id(N'f_test'

 

IQ

 

查询表

 select  table_name from sys.systable  t where table_type in ('BASE', 'GBL TEMP')
 and creator=user_id('***') order by table_name

 查询过程或者函数

 select proc_name from sys.sysprocedure where  user_name(creator)='***'

 查询作业

 select * from sys.sysevent

你可能感兴趣的:(sql,SQL Server,F#)