Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Command Line Args for SQL Express

Posted on 2007-03-19
16
Medium Priority
?
562 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
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.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

721 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