Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
EA
Starting Member
19 Posts |
Posted - 2007-05-01 : 10:54:26
|
| I want to drop users in several databases (but not all!). In pseudo code it's like:use database1goif exists (select name from sys.database_principals where upper(name) = 'name1todrop') drop user name1todropgoif exists (select name from sys.database_principals where upper(name) = 'name2todrop') drop user name2todropgouse database 2goif exists (select name from sys.database_principals where upper(name) = 'name1todrop') drop user name1todropgo..This is working fine. But now I want to make a stored procedure out of it.I can't use the 'use database' (a USE database statement is not allowed in a procedure, function or trigger.)The drop user only works for the current database. But how to make it current in a stored procedure? The databasename is not allowed in the syntax.... Any help or suggestions are welcome! |
|
|
|
|
|