Correction. You can't create a Stored Procedure in one DB (e.g. Master) to affect another DB (e.g. TempDB). Instead, you will need to simply create a Job (under Management) that uses the appropriate DB and appropriate Stored Procedures. Example:
EXEC sp_grantdbaccess 'DOMAIN\User'...
The TEMPDB is recreated each time that the SQL Server is restarted. As with all of your other databases, it uses the MODEL database as a template. Therefore, if the user is not defined within the Users of the MODEL database, they won't show up on the TEMPDB.
Rather than inserting a new user...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.