Solved

Command Line Args for SQL Express

Posted on 2007-03-19
16
524 Views
Last Modified: 2011-10-03
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.  
0
Comment
Question by:Sheritlw
  • 8
  • 5
  • 3
16 Comments
 
LVL 4

Expert Comment

by:meenasree
ID: 18754135
the below link has good info as to commandline args
http://msdn2.microsoft.com/en-us/library/ms165702.aspx
0
 

Author Comment

by:Sheritlw
ID: 18754150
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
0
 
LVL 4

Expert Comment

by:meenasree
ID: 18754154
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
0
 

Author Comment

by:Sheritlw
ID: 18754166
I can send command lines from my setup program, I just need to format to send
0
 
LVL 4

Expert Comment

by:meenasree
ID: 18754249
0
 

Author Comment

by:Sheritlw
ID: 18754261
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.
0
 
LVL 4

Assisted Solution

by:meenasree
meenasree earned 200 total points
ID: 18754281
SQLEXPR.EXE /qb ADDLOCAL=ALL INSTANCENAME=myInstanceName SAPWD=mySaPassword
0
 

Author Comment

by:Sheritlw
ID: 18754293
Does this make it so that it is a single user and what is instance name.... what you want to name server?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Expert Comment

by:meenasree
ID: 18754415
Instance name Specifies the instance of SQL Server to which to connect
0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 18761569
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.
0
 

Author Comment

by:Sheritlw
ID: 18762156
That would be great, but this is a distributed application that people will be downloading from many different software sites.
0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 18762403
I'm not sure I understand what the issue is. That will do exactly what you want, just put it in your install script.
0
 

Author Comment

by:Sheritlw
ID: 18775568
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.
0
 

Author Comment

by:Sheritlw
ID: 18775570
0
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 300 total points
ID: 18784829
Can't you just script it into your install application?

SQLCMD is installed with SQL Server. So whatever you're using to run the setup for SQL Server can then run this tool to create and manipulate databases.

For example you could have a batch file with two lines:

SETUP /whatever  
SQLCMD whatever


The first line installs SQL The second line runs SQLCMD.

This is of course an oversimplified example.
0
 

Author Comment

by:Sheritlw
ID: 18786071
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
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now