tsql - Create User from a different DB in SQL Server -


is there way can create user on database master db(or other db)

if exists (select 1   j_test.sys.database_principals  name = n'test_user')    drop user j_test.[test_user]; --doesnt't work. 

you either need change context database or dynamically go there:

exec j_test..sp_executesql n'drop user test_user;'; 

Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -