set nocount on
DECLARE @curObj VARCHAR(100)
DECLARE @grant_state VARCHAR(100)
SELECT A.name
INTO #objList
FROM sysobjects A
WHERE XTYPE = 'P' and name not like 'dt_%'
WHILE (SELECT COUNT(*) FROM #objList) > 0
BEGIN
SET @curObj = (SELECT TOP 1 name FROM #objList)
SET @grant_state= 'Grant exec on ' + @curObj + ' to [CORP\NBS5UNM]'
select @grant_state
exec (@grant_state)
DELETE FROM #objList WHERE name = @curObj
END
DROP TABLE #objList
GO
DECLARE @curObj VARCHAR(100)
DECLARE @grant_state VARCHAR(100)
SELECT A.name
INTO #objList
FROM sysobjects A
WHERE XTYPE = 'P' and name not like 'dt_%'
WHILE (SELECT COUNT(*) FROM #objList) > 0
BEGIN
SET @curObj = (SELECT TOP 1 name FROM #objList)
SET @grant_state= 'Grant exec on ' + @curObj + ' to [CORP\NBS5UNM]'
select @grant_state
exec (@grant_state)
DELETE FROM #objList WHERE name = @curObj
END
DROP TABLE #objList
GO
No comments:
Post a Comment