473,503 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Many Sql scripts to execute

27 New Member
I have 90 scripts in C:\SQL Scripts\*sql

how could i execute by command ,i saw many things on net but could execute it successfully,,,
I am using sql 2008 R2 , not a default instance
Feb 16 '13 #1
19 2584
Rabbit
12,516 Recognized Expert Moderator MVP
You can run this from the command line:
Expand|Select|Wrap|Line Numbers
  1. for %f in (*.sql) do sqlcmd /S <servername> /d <dbname> /E /i "%f"
Feb 16 '13 #2
waqar100
27 New Member
I installed SQL multiScripts software ,, trial version
Feb 17 '13 #3
NeoPa
32,557 Recognized Expert Moderator MVP
@Rabbit
Does your SQLCMD command cover the fact that the SQL Server is not running as the default instance?

@Waqar100
If you ask for assistance you should respond to when someone posts that help. If you have chosen to use special software to handle this in spite of standard software being available, and help for that given to you, surely you can explain why. Otherwise it seems like you have just ignored the expert whom you asked to help you.
Feb 17 '13 #4
Rabbit
12,516 Recognized Expert Moderator MVP
@NeoPa, oh, I'm not sure. If it doesn't there's probably a switch for it.
Feb 17 '13 #5
NeoPa
32,557 Recognized Expert Moderator MVP
Rabbit:
If it doesn't there's probably a switch for it.
That's cheating! :-D

OK. I looked it up myself (Connect to the Database Engine With sqlcmd). The syntax would be :
Expand|Select|Wrap|Line Numbers
  1. for %f in (*.sql) do sqlcmd /S <servername>\<instancename> /d <dbname> /E /i "%f"
Feb 18 '13 #6
waqar100
27 New Member
I am using this command,this will halt at.

Expand|Select|Wrap|Line Numbers
  1. for %f in (*.sql) do sqlcmd /S <WAQAR-PC>\<KARACHI20882>/d <SF_CORE_DEV_CMD> /E /i "%f"
See the image
http://postimg.org/image/6g76k7lax/
Now what should i do?
Jun 2 '13 #7
NeoPa
32,557 Recognized Expert Moderator MVP
<servername>\<instancename> = WAQAR-PC\KARACHI20882 and there is a space before the /d.

Try that and let us know how you get on.
Jun 4 '13 #8
waqar100
27 New Member
Thanks Neo Pa
Now i am stucking at this stage , what should i do the next.
http://postimg.org/image/l4k0bv6hl/

FYI: i have temporary i am testing on only 3 files a t this location
say 3 scripts in c folder

Path=C:\FOlder and they are respectively 1.sql, 2.sql and 3.sql.
Jun 9 '13 #9
Rabbit
12,516 Recognized Expert Moderator MVP
Please attach the image to the thread itself.
Jun 9 '13 #10
waqar100
27 New Member
which image @Rabbit? I didnt understand.
Jun 10 '13 #11
Rabbit
12,516 Recognized Expert Moderator MVP
You attached an link to an image. Our firewalls block external file storage sites.
Jun 11 '13 #12
waqar100
27 New Member
Thanks Neo Pa
Now i am stucking at this stage , what should i do the next.
http://postimg.org/image/l4k0bv6hl/

FYI: i have temporary i am testing on only 3 files a t this location
say 3 scripts in c folder

Path=C:\FOlder and they are respectively 1.sql, 2.sql and 3.sql.



Now the link of above image is



Now it is ok?
Attached Images
File Type: jpg Capture.jpg (20.1 KB, 148 views)
Jun 11 '13 #13
Rabbit
12,516 Recognized Expert Moderator MVP
That's too small to read. But it looks like a command prompt. So just type in the thread itself what the command prompt is showing.
Jun 11 '13 #14
waqar100
27 New Member
There are 2 snaps I attached of the different extension.if you are able to see then tell me the next steps.3 sql files are in C,, see the previous detail of this path.
Attached Images
File Type: jpg 1.jpg (41.8 KB, 177 views)
File Type: jpg Latest.jpg (41.3 KB, 141 views)
Jun 15 '13 #15
Rabbit
12,516 Recognized Expert Moderator MVP
It's too small for me to read. It's just command prompts, there's no need for screenshots, just type what it says in the thread.
Jun 15 '13 #16
waqar100
27 New Member
I typed already,& the issue is at the image,
Jun 15 '13 #17
Rabbit
12,516 Recognized Expert Moderator MVP
I already said I can't read the text in the image. Type the text in the image into the thread itself.
Jun 16 '13 #18
Oralloy
988 Recognized Expert Contributor
Waqar100,

remove the "<" and ">" from your command.

It should probably read:
Expand|Select|Wrap|Line Numbers
  1. 1.for %f in (*.sql) do sqlcmd /S WAQAR-PC\KARACHI20882 /d SF_CORE_DEV_CMD /E /i "%f"
Jun 16 '13 #19
nbiswas
149 New Member
c:\>for %f in (*.sql) do sqlcmd /S <servername> /d <dbname> /E /i "%f"
Jun 18 '13 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1955
by: Phil Grimpo | last post by:
I had previously explained this problem in a different thread, but now that I have an IISState log, I figured I'd re-start the thred. My situation and the log are following... I have a very odd...
0
853
by: Mr. x | last post by:
Hello, Where can I find many scripts for the developing on dotnet ? Thanks :)
2
1024
by: Eitan | last post by:
Hello, Where can I find good forums that includes many scripts for .net ? Thanks :)
1
3744
by: Crash | last post by:
Hi, ..NET v1.x SP1 VS 2003 SQL Server 2000 SP3 Server 2000, XP, Server 2003 I would like to programmatically execute {possibly many} SQL Server batch scripts. Aka I have many scripts that...
2
4847
by: Dave Hughes | last post by:
Just noticed something rather annoying after upgrading my test box (a Linux server running DB2 UDB v8 for LUW) to fixpak 11 (for reference it was previously on fixpak 7). In the past I've relied...
1
5354
by: szukteam | last post by:
I'm very new to java- as a matter of fact, I'd say that I know nothing about it....except for how to cut and paste free java script to my pages. I have the need for three different slide shows on...
6
10741
by: robert.waters | last post by:
Hello, Do you need to close an adodb recordset returned from a connection.execute(SQL) action? ex) set rcd = con.execute("SELECT * FROM TABLENAME") I know that close()ing objects that you...
7
1774
by: Michael | last post by:
I'm new to PHP. Evidently my ISP's server does not recognize <?php ... ?>, but it does recognize <script language="php"... </script>, which would imply that <?php ... ?is not portable. If in...
4
2009
by: Avaenuha | last post by:
I'm teaching myself UNIX, here, and I've written a shellscript that works fine if I use it while in the /bin directory, but if I try to use it from another directory, I get 'command not found'. ...
2
1635
by: simplicity | last post by:
This is erratic and not always reproducible. I have a large amount of data (SOAP) that I must parse and every one in a while, especially on slower machines the warning pops up about too many...
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6988
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.