Solved

Command Line Args for SQL Express

Posted on 2007-03-19
16
538 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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
 
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

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

738 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