--cd D:\poc\poc_dev\SQL\1.2.17.20100310.1700\3.StoredProcedures
--for /f "tokens=2 delims=." %i in ('dir *.sql /b') do echo insert into TmpObjName ( name ) values ('%i') >>list.txt
--select t2.name , * from sys.extended_properties t1
--inner join sys.tables t2 on t1.major_id = t2.object_id
--where t1.name = 'IsPlatform' and t1.value = '1'
DROP table #ProcList
go
--Grab all the platform tables for the current DB
SELECT IDENTITY(INT,1,1) AS ID,
name as Name
into #ProcList
from TmpObjName
DECLARE
@Loopid INT,
@MaxId INT
--Grab start and end values for the loop
SELECT @Loopid = 1,
@MaxId = MAX(ID)
FROM #ProcList
DECLARE
@SQL NVARCHAR(500),
@ProcName VARCHAR(400)
--This is where the loop starts
WHILE @Loopid <= @MaxId
BEGIN
--grab the function name and type
SELECT @ProcName = name
FROM #ProcList
WHERE ID = @Loopid
--Find out if it's a table-valued function
--print @ProcName
set @SQL =
'EXEC sys.sp_addextendedproperty @name=N''LastEditor'', @value=N''Yordan Georgiev'' , @level0type=N''SCHEMA'',@level0name=N''dbo'', @level1type=N''PROCEDURE'',@level1name=N''' + @ProcName+ ' '''
PRINT @SQL
EXEC sp_executesql @sql
--construct the statement
--increment counter
SET @Loopid = @Loopid + 1
END
--clean up
DROP TABLE #ProcList
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!