Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Granting automatic tempdb access.

Author  Topic 

mdelgado
Posting Yak Master

141 Posts

Posted - 2003-09-10 : 08:41:22
My SQL server passes stored procs to a web page. A few stored procedures create global temptables (i.e. ##temptable) in order to display the final resulset.

I created a unique sql login for the web application to run all of these procs called, "einstein".

My problem is that everytime the sql service is restarted, I have to manually go in and grant this login access to the tempdb database or else the web pages that use the sprocs that use gloabl temp tables will not work.

Is there a workaround to me having to manually restore security everytime the sql service restarts? Or is there a way for me to run a script like the one below everytime the service starts?

use tempdb
exec sp_grantdbaccess N'einstein', N'einstein'

I would hate to have to create a job that runs the above script every 30 minuts or so just so I'm covered in the event of the service being restarted.

Your feedback is much appreciated, thanks.

nr
SQLTeam MVY

12543 Posts

Posted - 2003-09-11 : 10:50:49
You can set a job to start when the agent starts - see the schedule.
Might be worth trying to add the user to model and see if that gets added to tempdb when it is created.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

mdelgado
Posting Yak Master

141 Posts

Posted - 2003-09-11 : 10:59:56
thank you; I could shoot myself for not having seen that.
:)
Go to Top of Page
   

- Advertisement -