Niko Fernandez
Niko Fernandez

Reputation: 11

Remove all SQL users from a DB

I have a database that I am migrating, but when I do the restore all the users of that database are also migrated.

Is there any way to do a restore of the DB only of the data? Without the users/roles

Or any way to remove all users from the DB?

(This users i want to remove)

In total there are 15BBDD with +50 users.

Upvotes: 1

Views: 1859

Answers (1)

Nenad Zivkovic
Nenad Zivkovic

Reputation: 18559

In Management Studio, you can right click on your database, select Tasks then Generate Scripts...

Generate scripts

On Choose Objects screen choose users you want to remove, or all.

Choose Users

On Set scripting options page, go to Advanced, find Script DROP and CREATE and choose option to only Script DROP Select option to open in a new query window. Next, next, finish and you'll have your script to drop all users.

Advanced and choose script DROP

Upvotes: 1

Related Questions