Re: User Mappings to TempDB

From: Jasper Smith (jasper_smith9_at_hotmail.com)
Date: 08/02/05


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.
>> >
>> >
>>
>>
>> 


Relevant Pages

  • NO COUNT
    ... into a SQL Server 7 database. ... SET NOCOUNT OFF ... just before committing/aborting a transaction ...
    (microsoft.public.sqlserver.programming)
  • Re: Urgent pls: Poor performance on update/insert
    ... SET NOCOUNT ON ... > I need to update a set of records in SQL server table. ... > If a record exits on database, ... guidid field is the key field on this table. ...
    (microsoft.public.vb.database.ado)
  • Re: Long pauses on enterprise manager.
    ... slow as it has to "startup" each database to enumerate the list. ... Jasper Smith (SQL Server MVP) ...
    (microsoft.public.sqlserver.setup)
  • Re: MS Access DAO -> ADO.NET Migration
    ... William Vaughn ... Microsoft MVP ... Hitchhiker's Guide to Visual Studio and SQL Server ... My migration app works building a SSCE database file with imported data ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Cluster will not fail over.
    ... > As far as the TCP/IP issue goes, you had to rebuild the cluster and were ... > able to restore the master database. ... > a cluster installation you'll have to revisit. ... >> This worked bringing up the sql server in minimal mode. ...
    (microsoft.public.sqlserver.clustering)