DbGuy98
DbGuy98

Reputation: 1

Encrypt an sql script to be run on a server

Our company has a proprietary t-sql script that we need to run on several SQL servers that are not owned by us. We would like a way to run this script so that it couldn't be copied via the file system or the clipboard. We usually login via a remote session (logmein or similar) so we are concerned a tech who has seen us run one script could prepare the next server to copy the script, by knowing how we would run it.

All the records the script creates will be in the db for them to view, we just wish to protect the script itself.

Is there any method that would not require significant development?

Upvotes: 0

Views: 444

Answers (2)

radar
radar

Reputation: 13425

you can use WITH ENCRYPTION option while creating the stored procedure or function so that underlying SQL can't be viewed but it can still be executed.

http://msdn.microsoft.com/en-us/library/ms187926.aspx

Upvotes: 1

Ronan Thibaudau
Ronan Thibaudau

Reputation: 3603

It's not possible to fully protect your script (it can always be captured) but if you don't want to distribute it as is for easy copy/paste you could make an application that does nothing more than connect to the database and run the script, and embed the script as an encrypted ressource in your application.

However i would simply suggest you don't do any of that and just trust your Customer, a situation where you don't trust your direct custom, with whom you're in direct contact, strikes me as very bad. It's also often very poorly thought out, you're imagining it as having more value than it has most likely.

Upvotes: 3

Related Questions