Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Security for running script
Message
 
 
To
22/03/2011 17:00:56
General information
Forum:
Microsoft SQL Server
Category:
Scripting
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01504580
Message ID:
01504583
Views:
48
This message has been marked as the solution to the initial question of the thread.
>Is there a way to detect, when running a script, the database that the current script window is showing? If yes, that would be nice as I have a script that will be executed by someone else and I need to make sure that the current database is not the main application database. Otherwise, it would wipe out a completely big table from the application. So, in the temporary database we are inserting some records from the main database, one of the first lines is a DROP TABLE. That is good but should only be executed if the current script window database does not correspond to a database name I would plug in the script.

Use db_Name() function to get current database name.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform