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
Post a Comment