Re: User Mappings to TempDB
From: Jasper Smith (jasper_smith9_at_hotmail.com)
Date: 08/02/05
- Next message: A.Seetharaman: "How to Grant permissions to Database"
- Previous message: Anthony Spiteri: "Re: User Mappings to TempDB"
- In reply to: Anthony Spiteri: "Re: User Mappings to TempDB"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 2 Aug 2005 07:30:36 +0100
You could use a startup procedure e.g.
use master
go
exec sp_addlogin 'tempdblogin','sdf76sdf7%£23fc'
go
create proc AddLoginToTempdb
as
set nocount on
exec tempdb.dbo.sp_grantdbaccess 'tempdblogin'
return
go
exec sp_procoption 'AddLoginToTempdb','startup','true'
go
For the permissions you could either do that in the startup proc or create a
role in model and the login to the role. The role would exist in new user
databases also but it wouldn't really do any harm if no users were in it.
-- HTH Jasper Smith (SQL Server MVP) http://www.sqldbatips.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Anthony Spiteri" <AnthonySpiteri@discussions.microsoft.com> wrote in message news:0250D03B-714D-4767-BD41-E6923354F640@microsoft.com... > Hmm, that would present just as much work in removing the user for every > new > database that we create... > > I am thinking that a script at startup would be the best option...but any > alternatives to that would be great. > > "Dan Guzman" wrote: > >> You can add the user to the model database so that all newly created >> databases, including tempdb, contain the user. If you don't want the >> user >> in a new database, you'll need to drop the user after database creation. >> >> -- >> Hope this helps. >> >> Dan Guzman >> SQL Server MVP >> >> "Anthony Spiteri" <Anthony Spiteri@discussions.microsoft.com> wrote in >> message news:1D912905-19F0-4695-8D42-DF8C3972AA60@microsoft.com... >> > Been having a look online to get a solution to the following. >> > >> > Just want to have a sql account always mapped to the the TempDb with >> > specific rights. >> > >> > At the moment, every restart/cluster move removes the user mappings I >> > had >> > set. >> > >> > >> >> >>
- Next message: A.Seetharaman: "How to Grant permissions to Database"
- Previous message: Anthony Spiteri: "Re: User Mappings to TempDB"
- In reply to: Anthony Spiteri: "Re: User Mappings to TempDB"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|