By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

Urgent Please help..

P: n/a
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql
Thanks

Jul 4 '06 #1
Share this Question
Share on Google+
17 Replies


P: n/a
Saps wrote on 04 jul 2006 in microsoft.public.inetserver.asp.general:
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql
"Urgent" only pisses off the helpful people in this NG.

What is an .sql file?
It seems not part of classic ASP, the NG's subject.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 4 '06 #2

P: n/a
Why does urgent have to piss someone cuz im really in need of help
here. anyways a .sql file is a sql script file which needs to be run
from a classic ASP page.

Evertjan. wrote:
Saps wrote on 04 jul 2006 in microsoft.public.inetserver.asp.general:
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql

"Urgent" only pisses off the helpful people in this NG.

What is an .sql file?
It seems not part of classic ASP, the NG's subject.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 4 '06 #3

P: n/a

"Saps" <sa***********@yahoo.comwrote in message
news:11**********************@b68g2000cwa.googlegr oups.com...
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql
Thanks
What do the SQL files contain? SQL Server T-SQL?
Do they contain multiple batches? (I.e. do they use the GO key word)
Are you familiar with ADO?

Jul 4 '06 #4

P: n/a
Saps wrote on 04 jul 2006 in microsoft.public.inetserver.asp.general:
Evertjan. wrote:
>Saps wrote on 04 jul 2006 in microsoft.public.inetserver.asp.general:
Hi all. Can anyone help me here. I have loads of .sql files and i
need a way to call these from my asp page so the user can run them
from the browser. Meaning i have a page with a list of all scripts.
each when clicked i am able to run the script. so HOW and what do i
do to call and run the .sql

"Urgent" only pisses off the helpful people in this NG.

What is an .sql file?
It seems not part of classic ASP, the NG's subject.
[please do not toppost on usenet, the same pisses off applies]
Why does urgent have to piss someone
It does not have to, off.
It is just the way it is.
People will answer in their own good time.
cuz im really in need of help here.
Evenso. This applies to most OQ's here.
A meaningful subjectfield text would help more. [field changed]
anyways a .sql file is a sql script file which needs to be run
from a classic ASP page.
Whose "need"?

It seems native classic ASP does not support it, based on the minute
info you give about the content of such files.

So another executing engine needs to be introduced,
and perhaps the type of database it is intended to run on.

Can you give info about that, Saps?
What DB and what DB-engine are you running?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 4 '06 #5

P: n/a
Anthony Jones wrote on 04 jul 2006 in
microsoft.public.inetserver.asp.general:
Are you familiar with ADO?
I met him in the theatre the other day.

Much ADO about nothing, he said.

It was like Jmail talking about the do's and don'ts of CDO and CDONT.

;-)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 4 '06 #6

P: n/a
The SQL file contains multiple select statements created using notepad,
that would obviously return some information. Yes I am familiar with
ADO. Currently if there are 3 sets of SQL statements, they are nt
separated by any GO. Altho i can impose them a format if required to
run from ASP.
Where i work, we have a set of users who develop these clean up
scripts(sql select statements) and upload them in a particular folder.
The target users who access this site are meant to execute these SQL
statements so they get the rows of data that the script returns. I know
its much simpler if the creators just give me the statements and i use
them ASP but its a matter of making it dynamic, they create and upload,
the users sees it and runs it.
thx for bearing with me and help will greatly b appreciated.
Anthony Jones wrote:
"Saps" <sa***********@yahoo.comwrote in message
news:11**********************@b68g2000cwa.googlegr oups.com...
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql
Thanks

What do the SQL files contain? SQL Server T-SQL?
Do they contain multiple batches? (I.e. do they use the GO key word)
Are you familiar with ADO?
Jul 4 '06 #7

P: n/a
CJM

"Saps" <sa***********@yahoo.comwrote in message
news:11**********************@b68g2000cwa.googlegr oups.com...
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql
Thanks
There is no native way that I know of, but I don't see why you can't just
read the T-SQL from the files and execute it via ADO.

It sounds a bit messy to me though, and we have no context in which to
answer. What do the scripts do? Who creates them? Who uses the application
(security may be an issue). What kind of SQL is being used?

More importantly, what are you trying to achieve? Why do you want users to
be about to run SQL scripts from ASP?

CJM
Jul 4 '06 #8

P: n/a
Saps wrote:
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql
Thanks
Sapa,

I've never used something like that, but considering that the sql
command in ASP is an ordinary string, I believe taht you may do what
you wnat by FSO.
Try to read the sql file and put its contents on a string and them
execute the command object.

Jul 4 '06 #9

P: n/a
"Evertjan." wrote ...
>Are you familiar with ADO?

I met him in the theatre the other day.

Much ADO about nothing, he said.

It was like Jmail talking about the do's and don'ts of CDO and CDONT.

;-)
For one so keen on the "rules" your post was kind OT wasn't it ;o)

And yes, I do appreciate the irony of my reply, and most likely
yours.....here we go! :o)

Regards

Rob
Jul 4 '06 #10

P: n/a
Saps wrote:
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql
Thanks
You would probably be better off if you encapsulated the T-SQL in those
script files into stored procedures which can easily be executed from an ASP
file via ADO.

CREATE PROCEDURE RunMySQL1 AS
<copy and paste your sql script file contents here>

Run the above script on your server, grant the appropriate permissions to
the users that need to run it, and, in your ASP page:

dim cn, proc
proc = request.form("selectedscript")
set cn=createobject("adodb.connection")
cn.open <your connection string>
'http://www.aspfaq.com/show.asp?id=2126
select case proc
case "1": cn.RunMySQL1
...
case else:
end select
cn.close: set cn=nothing

What is your perceived advantage in using script files instead of stored
procedures?

If you are stuck with script files, you have several options:
1. As stated by MFedatto, you can use FSO to read the sql from the file
(http://www.aspfaq.com/show.asp?id=2039) and execute it using an ADO
connection object. With this approach, you need to take care to strip out
non-T-SQL words like "GO"

2. Depending on your version of SQL Server, you can install either isql or
osql (look them up in SQL Books Online ... BOL) on your web server and use
wscript.shell to run the script files using the appropriate tool for your
sql server.

3. Again, depending on your version of SQL Server, install either SQL-DMO or
SMO (if using SQL 2005) and use them to run your script files (look them up
in BOL)

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 4 '06 #11

P: n/a

"Saps" <sa***********@yahoo.comwrote in message
news:11*********************@v61g2000cwv.googlegro ups.com...
The SQL file contains multiple select statements created using notepad,
that would obviously return some information. Yes I am familiar with
ADO. Currently if there are 3 sets of SQL statements, they are nt
separated by any GO. Altho i can impose them a format if required to
run from ASP.
Not having GO is a good thing.

As others have pointed out you could simply load the text of the file via
Scripting.FileSystemObject and execute the script via ADO.

You would have to impose that GO is not used since it's used to delimit
batches to be executed which is a facility not offered by ADO.
Where i work, we have a set of users who develop these clean up
scripts(sql select statements) and upload them in a particular folder.
The target users who access this site are meant to execute these SQL
statements so they get the rows of data that the script returns. I know
its much simpler if the creators just give me the statements and i use
them ASP but its a matter of making it dynamic, they create and upload,
the users sees it and runs it.
thx for bearing with me and help will greatly b appreciated.
Anthony Jones wrote:
"Saps" <sa***********@yahoo.comwrote in message
news:11**********************@b68g2000cwa.googlegr oups.com...
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql
Thanks
>
What do the SQL files contain? SQL Server T-SQL?
Do they contain multiple batches? (I.e. do they use the GO key word)
Are you familiar with ADO?

Jul 4 '06 #12

P: n/a
I think the more relevent issue is that your Subject should mention
something about the question your asking.
This helps keep the newgroup posts clean and easier to look through.

"Urgent Please help.."

Is an annoying and useless Subject title. At least to me it is.

Your also going to get a lot less people reading a post with a subject like
that.

"Saps" <sa***********@yahoo.comwrote in message
news:11**********************@a14g2000cwb.googlegr oups.com...
Why does urgent have to piss someone cuz im really in need of help
here. anyways a .sql file is a sql script file which needs to be run
from a classic ASP page.

Evertjan. wrote:
>Saps wrote on 04 jul 2006 in microsoft.public.inetserver.asp.general:
Hi all. Can anyone help me here. I have loads of .sql files and i need
a way to call these from my asp page so the user can run them from the
browser. Meaning i have a page with a list of all scripts. each when
clicked i am able to run the script. so HOW and what do i do to call
and run the .sql

"Urgent" only pisses off the helpful people in this NG.

What is an .sql file?
It seems not part of classic ASP, the NG's subject.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 4 '06 #13

P: n/a
Kyle Peterson wrote:
I think the more relevent issue is that your Subject should mention
something about the question your asking.
This helps keep the newgroup posts clean and easier to look through.

"Urgent Please help.."

Is an annoying and useless Subject title. At least to me it is.

Your also going to get a lot less people reading a post with a
subject like that.

You know, I would typically agree with that statement, but ...
compare the number of responses in this thread to the number of responses
the original thread (subject: "Execute .sql scripts from ASP") received ...
;-)

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 4 '06 #14

P: n/a
I never saw that anywhere.
original thread (subject: "Execute .sql scripts from ASP")

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Kyle Peterson wrote:
>I think the more relevent issue is that your Subject should mention
something about the question your asking.
This helps keep the newgroup posts clean and easier to look through.

"Urgent Please help.."

Is an annoying and useless Subject title. At least to me it is.

Your also going to get a lot less people reading a post with a
subject like that.


You know, I would typically agree with that statement, but ...
compare the number of responses in this thread to the number of responses
the original thread (subject: "Execute .sql scripts from ASP") received
... ;-)

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 5 '06 #15

P: n/a
but I just found it
"Kyle Peterson" <ky*****@hotmail.comwrote in message
news:eZ**************@TK2MSFTNGP03.phx.gbl...
>I never saw that anywhere.
original thread (subject: "Execute .sql scripts from ASP")

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>Kyle Peterson wrote:
>>I think the more relevent issue is that your Subject should mention
something about the question your asking.
This helps keep the newgroup posts clean and easier to look through.

"Urgent Please help.."

Is an annoying and useless Subject title. At least to me it is.

Your also going to get a lot less people reading a post with a
subject like that.


You know, I would typically agree with that statement, but ...
compare the number of responses in this thread to the number of responses
the original thread (subject: "Execute .sql scripts from ASP") received
... ;-)

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Jul 5 '06 #16

P: n/a
Yes Bob. i had posted this question when i was in most need of help.
and when i open to chk if anyone replied..NOONE did. i had to put it
this way for people to atleast open it and chk if they can help. but
anyways i have really appreciated the help i gt. yes like u guys
mentioned, i can read each line of the script store it in a string and
execute it. im going to have to try doing that. Can i get a sample code
of how to do that tho. Please.
And hey guys sorry for all the botherations u'll had answering this
thread but it has helped me ALOT. thx.

Bob Barrows [MVP] wrote:
Kyle Peterson wrote:
I think the more relevent issue is that your Subject should mention
something about the question your asking.
This helps keep the newgroup posts clean and easier to look through.

"Urgent Please help.."

Is an annoying and useless Subject title. At least to me it is.

Your also going to get a lot less people reading a post with a
subject like that.


You know, I would typically agree with that statement, but ...
compare the number of responses in this thread to the number of responses
the original thread (subject: "Execute .sql scripts from ASP") received ...
;-)

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 5 '06 #17

P: n/a
Saps wrote:
Yes Bob. i had posted this question when i was in most need of help.
and when i open to chk if anyone replied..NOONE did. i had to put it
this way
No, you didn't. You could (should) have replied to the original post.
for people to atleast open it and chk if they can help.
but
anyways i have really appreciated the help i gt. yes like u guys
mentioned, i can read each line of the script store it in a string and
execute it. im going to have to try doing that.
Why do you have to use .sql files? You have yet to answer this question.
SQL files are not really a good mechanism for implementing application
logic. They are really meant for maintenance tasks that are infrequently
performed.
Can i get a sample
code of how to do that tho. Please.
Unless someone has a lot of time on his hands (or is intrigued by the
problem), nobody is going to write it for you. Look at the link I
provided (http://www.aspfaq.com/show.asp?id=2039), do some reading in
the other articles on that site, and try doing it yourself. If you get
stuck, come back and show us where you are stuck.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 5 '06 #18

This discussion thread is closed

Replies have been disabled for this discussion.