EXEC sp_databases GO |
CREATE TABLE #sp_result ( DATABASE_NAME sysname, DATABASE_SIZE int, REMARKS varchar(254) NULL ) GO INSERT INTO #sp_result EXEC ('sp_databases') GO |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='mytable' |
SELECT OBJECT_NAME (id) FROM sysobjects WHERE xtype = 'U' AND OBJECTPROPERTY (id, 'IsMSShipped') = 0 |
SELECT name FROM sysindexes WHERE id = OBJECT_ID ('mytable') AND indid > 0 |
DECLARE @sp_name nvarchar(400) DECLARE @sp_content nvarchar(2000) DECLARE @asbegin int declare @now datetime select @now = getdate() DECLARE sp_cursor CURSOR FOR SELECT object_name(id) FROM sysobjects WHERE xtype = 'P' AND type = 'P' AND crdate < @now AND OBJECTPROPERTY(id, 'IsMSShipped')=0 OPEN sp_cursor FETCH NEXT FROM sp_cursor INTO @sp_name WHILE @@FETCH_STATUS = 0 BEGIN SELECT @sp_content = text FROM syscomments WHERE id = OBJECT_ID(@sp_name) SELECT @asbegin = PATINDEX ( '%AS' + char(13) + '%', @sp_content) SELECT @sp_content = SUBSTRING(@sp_content, 1, @asbegin - 1) + ' WITH ENCRYPTION AS' + SUBSTRING (@sp_content, @asbegin+2, LEN(@sp_content)) SELECT @sp_name = 'DROP PROCEDURE [' + @sp_name + ']' EXEC sp_executesql @sp_name EXEC sp_executesql @sp_content FETCH NEXT FROM sp_cursor INTO @sp_name END CLOSE sp_cursor DEALLOCATE sp_cursor |
欢迎光临 DIY编程器网 (http://diybcq.com/) | Powered by Discuz! X3.2 |