Mask password in sqlcmd command

How it is possible to avoid putting in light the password of one to use sql in a sqlcmd script?

Thanks

bibi
bibi92Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Lara FConnect With a Mentor EACommented:
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
 
bibi92Author Commented:
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
 
bibi92Author Commented:
thanks bibi
0
All Courses

From novice to tech pro — start learning today.