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

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -