--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 #TableList
go
--Grab all the platform tables for the current DB
SELECT IDENTITY(INT,1,1) AS ID,
t2.name as Name
into #TableList
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'
DECLARE
@Loopid INT,
@MaxId INT
--Grab start and end values for the loop
SELECT @Loopid = 1,
@MaxId = MAX(ID)
FROM #TableList
DECLARE
@SQL VARCHAR(500),
@TableName VARCHAR(400)
--This is where the loop starts
WHILE @Loopid <= @MaxId
BEGIN
--grab the function name and type
SELECT @TableName = name
FROM #TableList
WHERE ID = @Loopid
--Find out if it's a table-valued function
print @tableName
--construct the statement
--increment counter
SET @Loopid = @Loopid + 1
END
--clean up
DROP TABLE #TableList
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 !!!!