Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQLCMD - Missing expression after unary operator... Expand / Collapse
Author
Message
Posted Wednesday, February 22, 2012 12:08 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, February 23, 2012 7:12 AM
Points: 1, Visits: 3
Noob to using SQLCMD and getting this when running script from Powershell. Any help would be greatly appreciated!!!!

PS C:\> SQLCMD -S CONTOSOWXP01\SQLEXPRESS CREATE LOGIN [NewUser] WITH PASSWORD = 'password', DEFAULT_DATABASE=[Mydatabase], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
Sqlcmd: 'CREATE LOGIN [NewUser] WITH PASSWORD = password DEFAULT_DATABASE=[Mydatabase] CHECK_EXPIRATION=OFF CHECK_POLIC
=OFF': Unexpected argument. Enter '-?' for help.
PS C:\> -?
Missing expression after unary operator '-'.
At line:1 char:2
+ - <<<< ?
PS C:\>
Post #1256219
Posted Monday, March 5, 2012 2:22 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 2:53 AM
Points: 1,101, Visits: 5,290
Try this:
SQLCMD -S CONTOSOWXP01\SQLEXPRESS -Q "CREATE LOGIN [NewUser] WITH PASSWORD = 'password', DEFAULT_DATABASE=[Mydatabase], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF"
Post #1261454
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse