+ Reply to Thread
Results 1 to 12 of 12

Calling Stored Procedure

  1. #1
    Forum Contributor
    Join Date
    12-20-2006
    Posts
    127

    Calling Stored Procedure

    Is it possible to call a stored proc from excel and pass through a paramter?

    If it is would anyone have a clue how to do this?

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    A bit more detail of what you are trying to acheive will result in a better answer
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Contributor
    Join Date
    12-20-2006
    Posts
    127

    stored proc

    i have built a simple query on sql server which requires a date. I would like to call this stored proc from excel and pass the dat and return the data into a worksheet.

    hope this helps

  4. #4
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76
    My example:
    Please Login or Register  to view this content.
    "Exec Forms_2_4_Log ""4"" ,""2007-01-01"",""2007-05-03""")-
    is the Stored Proc Call

  5. #5
    Forum Contributor
    Join Date
    12-20-2006
    Posts
    127

    Query

    Many thanks for your response.

    "Exec Forms_2_4_Log ""4"" ,""2007-01-01"",""2007-05-03"""

    How is this broken down?

    Im assuming that Forms_2_4_Log is the name of the stored proc, what is the 4? and im assuming that the dates act as from and to date parameters?

  6. #6
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76
    My Stored Proc has 3 parameters.
    "4" is one of them.
    You need only the 2-nd and the 3-d ones.

  7. #7
    Forum Contributor
    Join Date
    12-20-2006
    Posts
    127

    Question

    How does the below know which parameter, which value is being passed in to? All i can see is values but no paremeter references?

  8. #8
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76
    I suppose you have created a stored procedure in
    SQL Server or alike.
    If not, tell what database you use .

  9. #9
    Forum Contributor
    Join Date
    12-20-2006
    Posts
    127

    im using sql server enterprise manager

    im using sql server enterprise manager

  10. #10
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76
    Here is the Procedure I've created in Enterprize Manager.
    Please Login or Register  to view this content.
    You could see above calling this procedure.
    Just remove "4" from what i wrote.
    Replace this code by yours.
    @DateFrom and @DateTo are the parameters.
    Naming is free.

  11. #11
    Forum Contributor
    Join Date
    12-20-2006
    Posts
    127

    Parameters

    Firstly thabnk you for your help.

    Im good with setting up the stored proc i just wasnt sure how the stored proc would now which date was for which parameter but im assuming that the first value provided will automatically be picked up by the first parameter and so on.

    You dont have to define in excel @DateFrom = 'date' and @dateto = 'date'

  12. #12
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76
    Your conclusion is correct.
    Good luck in our hard work!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1