I need to develop a T-SQL insert script for use on a remote SQL 2005 Express instance but I would like the script to include the necessary SQL credentials so all the user has to do is execute the script. What is the easiest way to accomplish this?
T-sql – How to run a T-SQL Script using SQL Credentials
scriptingSecurityt-sql
Related Question
- T-sql – Create a T-sql script JOB SQL-2012 and scheduled
- Sql-server – How to take SQL Server databases backup using .bat script file with time stamp
- Postgresql – How to manipulate bytea data when using backup script as a template
- How to preserve sqlplus session in shell script
- Sql-server – How to migrate SQL Server credentials from 2005 to 2008 R2
- Sql-server – How to secure SQL Agent Job that INSERTS to a linked server
Best Answer
As you describe it, it's not going to work. The T-SQL script needs to run on a SQL Server which means that it needs to be run in an appropriately-authenticated session.
One option would be to write the TSQL script, and then provide it with a VBScript or CMD file or PowerShell script that'll launch the TSQL at the correct server with the right credentials.