Link to home
Start Free TrialLog in
Avatar of Sheritlw
SheritlwFlag for United States of America

asked on

Command Line Args for SQL Express

I need to create a command line argument for my distributed setup that will tell SQL Express, to make the db single user mode only, as quite install ( /qb parameter), add the user name and password.
I have looked at Microsoft's site, but no real structure there.  What I need is a sample of what the command line would look like.  
Avatar of meenasree
meenasree
Flag of India image

the below link has good info as to commandline args
http://msdn2.microsoft.com/en-us/library/ms165702.aspx
Avatar of Sheritlw

ASKER

That is the same link I looked at.  I need something like

"Setup.exe server:.\SQLEXPRESS /database:Name /username:UserName /password:Password /qb"

but for sqlexpress command line
you cannot tell the setup.exe instead you can create a customaction that will have a script or batch file that calls the cmdline utility to tell sqlexpress to do what you want
I can send command lines from my setup program, I just need to format to send
I read that one to.  Before I posted this questions I looked all through the web and found a lot of information.  Unforntunetley I am not familiar enough with command line arguments and there format.  Above, I provided a command line arg example of another type of install.  What I need is the actual argument line that I would use to do what I specified in my question for SQL Express.
Please no more links, but thank you for trying.
SOLUTION
Avatar of meenasree
meenasree
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Does this make it so that it is a single user and what is instance name.... what you want to name server?
Instance name Specifies the instance of SQL Server to which to connect
Avatar of nmcdermaid
nmcdermaid

To make it single user, install SQLExpress, create your database, then connect using SQLCMD (a command line tool) and submit this SQL:

ALTER DATABASE <yourdbname> SET SINGLE_USER WITH ROLLBACK IMMEDIATE

You can't make the entire SQL Server single user, only particular databases.
That would be great, but this is a distributed application that people will be downloading from many different software sites.
I'm not sure I understand what the issue is. That will do exactly what you want, just put it in your install script.
Hi,

I just can't use another tool to install sql server.  I would have to operate that tool from the command line also, so I am trying to find another way to do everything from my setup.   I currently have the setup downloading, unpacking and installing sql server express. I am looking into a template.ini  (microsoft site) file to set parameters, like single user, instead of download, installing and activing another tool using the command line.  
Any other information that doesn't require me to use another tool would be great.
Thanks.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have figured it out using the template.ini sample from microsoft.  I can now download, unpack, install and then install sql server using the following command line.
start /wait setup.exe /qb /settings".._TempFolder.."\\SQLXNew.ini
You have been a great help so I am awarding you all the points.

Thanks for all your help