I have created a stored procedure, which creates different username and password.But i have condition that for next time when stored procedure is called, it should delete previous user created by same stored procedure.And we are not supposed to store user details in table.
So could anyone can suggest me how to know those users which are created by only this stored procedure?
Thanks.
Sql-server – How to check which users have been created by specific stored procedure in sql server
sql server
Related Question
- Sql-server – How to change database owner for login and database created inside stored procedure
- SQL Server – Using Temp Table in Stored Procedure for Concurrent Users
- SQL Server – How to Create a Table Within a Stored Procedure
- Sql-server – Unable to create stored procedure to access excel files in SQL Server
- Sql-server – Implementing audit trail ms sql using stored procedure
- Sql-server – SQL Insert with soft row limit in stored procedure
- SQL Server – When Multiple Users Can’t Simultaneously Run a Stored Procedure with Temp Table
Best Answer
You can't without storing something uniquely identifying, particularly if (when) users/logins are dropped and recreated by other processes than the stored procedure.
Perhaps you could store just the principal_id and create_date from sys.server_principals, and the same from sys.database_principals; nothing identifying in particular, but the pair together should be a good indication that these are the right rows.