I create some migration scripts to generate a SQL server database from scratch.
In my 0005-create_login.up.sql script, I have something like:
CREATE A CONNECTION [mylogin] WITH PASSWORD = N = xxx = & # 39; GO
And in my & 0005-create_login.down.sql & # 39;
DROP LOGIN [appws] GO
Now I would like to delete the ID only if it is not used in another database. I've looked at the code sp_helplogins with:
sp_helptext & # 39; sp_helplogins & # 39;
but it's really complex. I wonder if there is an easier way to get an identifier with the databases used.