Urgent Please help..

Discussion in 'ASP General' started by Saps, Jul 4, 2006.

  1. Saps

    Saps Guest

    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
     
    Saps, Jul 4, 2006
    #1
    1. Advertising

  2. Saps

    Evertjan. Guest

    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)
     
    Evertjan., Jul 4, 2006
    #2
    1. Advertising

  3. Saps

    Saps Guest

    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)
     
    Saps, Jul 4, 2006
    #3
  4. "Saps" <> wrote in message
    news:...
    > 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?
     
    Anthony Jones, Jul 4, 2006
    #4
  5. Saps

    Evertjan. Guest

    Running .sql files was:Re: Urgent Please help..

    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)
     
    Evertjan., Jul 4, 2006
    #5
  6. Saps

    Evertjan. Guest

    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)
     
    Evertjan., Jul 4, 2006
    #6
  7. Saps

    Saps Guest

    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" <> wrote in message
    > news:...
    > > 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?
     
    Saps, Jul 4, 2006
    #7
  8. Saps

    CJM Guest

    "Saps" <> wrote in message
    news:...
    > 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
     
    CJM, Jul 4, 2006
    #8
  9. Saps

    MFedatto Guest

    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.
     
    MFedatto, Jul 4, 2006
    #9
  10. Saps

    Rob Meade Guest

    "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! :eek:)

    Regards

    Rob
     
    Rob Meade, Jul 4, 2006
    #10
  11. 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"
     
    Bob Barrows [MVP], Jul 4, 2006
    #11
  12. "Saps" <> wrote in message
    news:...
    > 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" <> wrote in message
    > > news:...
    > > > 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?

    >
     
    Anthony Jones, Jul 4, 2006
    #12
  13. 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" <> wrote in message
    news:...
    > 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)

    >
     
    Kyle Peterson, Jul 4, 2006
    #13
  14. 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"
     
    Bob Barrows [MVP], Jul 4, 2006
    #14
  15. I never saw that anywhere.


    original thread (subject: "Execute .sql scripts from ASP")



    "Bob Barrows [MVP]" <> wrote in message
    news:%23CZGW$...
    > 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"
    >
     
    Kyle Peterson, Jul 5, 2006
    #15
  16. but I just found it


    "Kyle Peterson" <> wrote in message
    news:...
    >I never saw that anywhere.
    >
    >
    > original thread (subject: "Execute .sql scripts from ASP")
    >
    >
    >
    > "Bob Barrows [MVP]" <> wrote in message
    > news:%23CZGW$...
    >> 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"
    >>

    >
    >
     
    Kyle Peterson, Jul 5, 2006
    #16
  17. Saps

    Saps Guest

    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"
     
    Saps, Jul 5, 2006
    #17
  18. 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.
     
    Bob Barrows [MVP], Jul 5, 2006
    #18
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    522
    Chris Uppal
    May 5, 2005
  2. Yucky Corpulent
    Replies:
    5
    Views:
    411
  3. KK
    Replies:
    2
    Views:
    596
    Big Brian
    Oct 14, 2003
  4. MuZZy
    Replies:
    7
    Views:
    1,767
    Mike Hewson
    Jan 7, 2005
  5. Sachin Jagtap

    URGENT !! QUEUE STL PROBLEM URGENT!!

    Sachin Jagtap, Apr 28, 2005, in forum: C++
    Replies:
    4
    Views:
    1,045
    Mark Stijnman
    Apr 29, 2005
Loading...

Share This Page