Solved

Mask password in sqlcmd command

Posted on 2010-09-10
3
1,680 Views
Last Modified: 2012-05-10
How it is possible to avoid putting in light the password of one to use sql in a sqlcmd script?

Thanks

bibi
0
Comment
Question by:bibi92
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
Larissa T earned 500 total points
ID: 33648330
from http://msdn.microsoft.com/en-us/library/ms162773.aspx



The SQLCMDPASSWORD environment variable lets you set a default password for the current session. Therefore, passwords do not have to be hard-coded into batch files.
0
 

Author Comment

by:bibi92
ID: 33715104
Thanks, I have tested this :

SET SQLCMDUSER=B00A
SET SQLCMDPASSWORD=toto
SET SQLCMDSERVER=SRVSERVER\TEST
SET SQLCMDDBNAME=dbname
sqlcmd  -Q "select count(*) from ATEST" -o d:\test.sql

But, I have this error:
Login failed for user 'B00A'.

Thanks
bibi
0
 

Author Closing Comment

by:bibi92
ID: 33715988
thanks bibi
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question