select a.name,a.[type],b.[definition] from sys.all_objects a,sys.sql_modules b where a.is_ms_shipped=0 and a.object_id = b.object_id and a.[type] in ('P','V','AF') where a.name='Storage Name or View Name ' order by a.[name] asc 如果找存储过程 sp_helptext 's…
脚本: use master; go ---声明变量 declare @dbName nvarchar(max)='MG_DATA'; ),) +'_'+ DateName(hour,GetDate())+DateName(minute,GetDate()) +DateName(second,GetDate())+'.bak'; ---备份数据库 ) SET @kid='' )) FROM master..sysprocesses WHERE dbid=DB_ID(@dbName) PRINT…
SELECT name, type_desc FROM sys.all_sql_modules s INNER JOIN sys.all_objects o ON s.object_id = o.object_id WHERE definition LIKE '%关键字%' ORDER BY type_desc, name; SELECT name, xtype FROM sysobjects o, syscomments s WHERE o.id = s.id AND text LIKE '%…