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.
| Author |
Topic |
|
donpolix
Yak Posting Veteran
97 Posts |
Posted - 2005-05-13 : 11:32:24
|
| I want to create a startup script that adds login and sets the permissions on tempdb database. I created a sql script containing the sql to add the login/permissions in a text file, feed it in osql command (with tempdb set as the db), w/c is then run by xp_cmdshell inside a stored proc in master - as startup. It seemed to work fine when I tested in my local pc, however, in production (when on one instance, the server was restarted - for security patch reason, it didn't work.).Do you guys have any other way or idea of doing it? Any help is appreciated. Thanks. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-05-13 : 17:38:04
|
| Put these things in the model database. Tempdb gets created from that database as the model.Tara |
 |
|
|
donpolix
Yak Posting Veteran
97 Posts |
Posted - 2005-05-23 : 19:02:27
|
| If I do that, then all of newly created tables will apply the permissions, which should not be the case. The startup script targets only specifice tables on some databases.Donn Policarpio |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-05-23 : 19:18:05
|
| Try creating an SP in master to do it and setting it to run on startup.==========================================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. |
 |
|
|
donpolix
Yak Posting Veteran
97 Posts |
Posted - 2005-05-24 : 14:25:55
|
| That's actually the first thing that I did (read on my first post).Hey nr, you might have a script in mind that works inside an SP.. that sets permissions on objects for a user.Let me see it. Thanks!Donn Policarpio |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-05-24 : 19:27:09
|
| exec tempdb..sp_grantdbaccess ...exec tempdb..sp_addrolemember ...exec tempdb..sp_executesql N'grant ....'==========================================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. |
 |
|
|
donpolix
Yak Posting Veteran
97 Posts |
Posted - 2005-05-27 : 05:37:40
|
| That's it! Just exactly what I needed.. Thanks a lot nr!Donn Policarpio |
 |
|
|
|
|
|