Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Deploying Scripts with SQLCMD


Deploying Scripts with SQLCMD

Author
Message
David.Poole
David.Poole
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3674 Visits: 3114
Comments posted to this topic are about the item Deploying Scripts with SQLCMD

LinkedIn Profile

Newbie on www.simple-talk.com
Adam Aspin
Adam Aspin
SSC-Enthusiastic
SSC-Enthusiastic (183 reputation)SSC-Enthusiastic (183 reputation)SSC-Enthusiastic (183 reputation)SSC-Enthusiastic (183 reputation)SSC-Enthusiastic (183 reputation)SSC-Enthusiastic (183 reputation)SSC-Enthusiastic (183 reputation)SSC-Enthusiastic (183 reputation)

Group: General Forum Members
Points: 183 Visits: 1028
Good stuff!

Have you ever had the (mis)fortune to use MSbuild too?

Adam
kuldipMCA
kuldipMCA
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
Points: 24 Visits: 144
Fatal scripting error. Cannot open connection specified in the SQLCMD script.
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

i got like that error when i do connect with the use of the sqlcmd.
Jim Russell-390299
Jim Russell-390299
SSC-Addicted
SSC-Addicted (449 reputation)SSC-Addicted (449 reputation)SSC-Addicted (449 reputation)SSC-Addicted (449 reputation)SSC-Addicted (449 reputation)SSC-Addicted (449 reputation)SSC-Addicted (449 reputation)SSC-Addicted (449 reputation)

Group: General Forum Members
Points: 449 Visits: 1403
Excellent!
I have reached the stage in life where if it isn't scripted, I screw it up. How nice to learn about yet another scripting strategy.
yordan.georgiev
yordan.georgiev
Grasshopper
Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)

Group: General Forum Members
Points: 13 Visits: 47
for the most bravest here is a perl script to run multiple sql scirpts ...

requirement: the scirpts should be numbered:
1.RUN.scriptname.sql
2.RUN.scriptName2.sql
3...
n. RUN.scirptname3.sql

and placed in the same directory as the perl script

You can create a command line executable for it ( does not required Perl on the running machine ) with par or perl2exe ...

Anybody interested in ... I could put a link for binary download it ...

Grab the source at :

http://ysgitdiary.blogspot.com/2009/03/perl-script-to-run-sql-scripts-for-sql.html


Comments , shouts boos etc. would be highly appreciated .. .
R M Buda
R M Buda
SSC-Enthusiastic
SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)

Group: General Forum Members
Points: 174 Visits: 295
Great article, David.
I had not seen examples of the error and standard outputs before.


Kuldip: it looks as though your windows login does not have windows integrated access to the server. You need to supply a SQL user name and password as part of the SQLCMD connect command or on the command line.

kuldip.bhatt (3/24/2009)
Fatal scripting error. Cannot open connection specified in the SQLCMD script.
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

i got like that error when i do connect with the use of the sqlcmd.

kuldipMCA
kuldipMCA
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
Points: 24 Visits: 144
how i give the usrename and password in the sql command?

:setvar Maindbserver "NHSserver"
:setvar Maindb "NHS_031209"
:Connect $(Maindbserver)
go
$ maindb

this is my code.

in this script how i can give user name and password?

My question is if diff servers has diffrent password then
what is the solution for this.

you must give Password and usrename.
Phil Factor
Phil Factor
Right there with Babe
Right there with Babe (741 reputation)Right there with Babe (741 reputation)Right there with Babe (741 reputation)Right there with Babe (741 reputation)Right there with Babe (741 reputation)Right there with Babe (741 reputation)Right there with Babe (741 reputation)Right there with Babe (741 reputation)

Group: General Forum Members
Points: 741 Visits: 2937
OOh yes. SQLCMD! I agree wholeheartedly that it is an essential for quickly automating complex processes across several servers. I love it. It is so good that one is tempted to keep it to oneself, and amaze people with one's wizardry.

Robyn and I wrote a workbench a while back which might help as a follow-up to David's excellent introduction. The SQLCMD workbench

I notice that the SQL Server 2008 version of SQLCMD is very similar to that of SQL Server 2005. Have they improved anything, or is SQLCMD one of those tools they have left to fester?


Best wishes,

Phil Factor
Simple Talk
alen teplitsky
alen teplitsky
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1595 Visits: 4621
good stuff, we're not under the same constraints here but using this we can build a deployment pack and execute it. the way it is now it's a manual process of running different scripts as specified by dev
David.Poole
David.Poole
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3674 Visits: 3114
kuldip.bhatt (3/24/2009)
how i give the usrename and password in the sql command?

:setvar Maindbserver "NHSserver"
:setvar Maindb "NHS_031209"
:Connect $(Maindbserver)
go
$ maindb




:connect $(Maindbserver) -U YourUserName -P YourPassword

Personally I would avoid SQL standard security for scripts like the plague. It would mean you have a clear text file with credentials exposed.

LinkedIn Profile

Newbie on www.simple-talk.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search