Solved

Command Line Args for SQL Express

Posted on 2007-03-19
16
549 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
[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
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:Sheritlw
ID: 18754166
I can send command lines from my setup program, I just need to format to send
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
 
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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

617 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