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 2005 Forums
 Transact-SQL (2005)
 Avoid a script from running

Author  Topic 

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2009-03-31 : 12:09:23
Hi there,

I'm creating a SQL script to add test data to a database. To begin with, the script will delete the contents of several of the db's tables.

What is a good way of avoiding this script from accidentally being run on the live version of the database?

Cheers, XF.

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-03-31 : 12:39:10

have the script check what server it is currently on? If it is the production server, just exit the script.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL or How to sell Used Cars
For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2009-03-31 : 13:24:51
One day the hosting company might happen to change their server name to mine!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-31 : 13:35:04
use permissions for this.grant execute permissions of script only for relevant permissions.
Go to Top of Page

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2009-03-31 : 15:39:36
So are you saying I'd grant execute permissions to the script for a specific user and only have that user on the dev db?
Go to Top of Page
   

- Advertisement -