Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Security for running script
Message
 
 
À
22/03/2011 17:00:56
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Scripting
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01504580
Message ID:
01504583
Vues:
49
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform