SQL Stored Procedures - How to run from vbscript w/variables?

Posted on 2011-05-12
Last Modified: 2012-05-11

This may be a relatively easy question for you guys to answer, but I'm stuck on the concept in what to do with connecting to SQL via VBScript and doing the following:

I need to have computers that run a VBScript, send a couple of variables up to a SQL Server.
I then need SQL server to run a query based off of the variable it receives from the computer.
All records that are returned in SQL need to be passed back to the original computer as VBScript variables.

I have the DB already defined with tables/views.  I don't have any stored procedures built yet.

I can't run the query on the computer itself...  Only have it send variables, and then receive replies from SQL (If this makes sense).

Is this possible?  Thanks for any information you can provide.
Question by:usslindstrom
    LVL 23

    Accepted Solution

    - see if this article on VBA/VBScript (ASP) invoke SQL Server stored procedure helps to get you started:
    LVL 12

    Assisted Solution

    Is it VB or VB.Net??

    If VB 6.0 then you could have done it through ADO command objects and in VB.Net rich set of ADO.Net objects like Adapter, Command, Dataset etc are available to fulfil these kinds of needs.

    See this link for example for VB 6.0 help
    LVL 5

    Author Closing Comment

    Thank you both for your assistance.

    Using both those links I was able to piece together some code that was in the direction I was needing.

    Much appreciated!

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Systems talking to each other 5 73
    best way to upgrade 3 29
    Date Differences SSRS 3 27
    SQL Split output 2 6
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now