H
hnwhh
Unregistered / Unconfirmed
GUEST, unregistred user!
编译可以过,但使用的时候提示我语法错误<br>create PROCEDURE granttable (@userName varchar(30)) AS <br>begin<br> declare @uname varchar(200)<br> declare @type varchar(10)<br> <br> declare cur1 cursor for <br> (select name from sysobjects where (xtype='U' or xtype='V' or xtype='P') and status>0)<br><br> open cur1<br> fetch next from cur1 into @uname<br> while @@fetch_status=0<br> begin<br> select @type=(select xtype from sysobjects where name=@uname)<br> <br> if @type!='P'<br> exec ('GRANT SELECT,INSERT,UPDATE,DELETE ON '+ @uname +' TO '+@userName) <br> else<br> exec ('GRANT EXEC ON '+ @uname +' TO '+@userName) <br><br> fetch next from cur1 into @uname <br> end <br><br> close cur1 <br> deallocate cur1<br><br><br>end