+ Reply to Thread
Results 1 to 3 of 3

Thread: Want to use Excel column cells as parameters to SQLSERVER query

  1. #1
    Registered User
    Join Date
    06-03-2010
    Location
    Tamarac, USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Question Want to use Excel column cells as parameters to SQLSERVER query

    What I am trying to do is have an Excel Sheet with a set of values in Column A and
    run a sql query using the values in column A to populate the corresponding cell on the same row in column B with an aggregrate value (MAX). Column B should contain the last active date for the part.

    (Before SQL run)
    Column A    Column B
    part1            <null>
    part2            <null>
    part3            <null>
    
    
    (After SQL run)
    
    Column A    Column B
    part1            2010-08-01
    part2            2010-07-01
    part3            2009-01-01
    
    and so on
    I am using Excel 2010, SQLSERVER 2008.

    My procedure is as follows: On the ribbon select the DATA tab, then CONNECTIONS button, then select my procedure X from the WORKBOOK CONNECTION list, press the PROPERTIES button on the same screen. press the DEFINITION tab on the CONNECTION properties screen, change the COMMAND TYPE to 'sql' and type the
    following in the COMMAND TEXT window .

    select name 
    from pbaTable
    where
    pbaid = ?????
    I've tried many things where the ????? are but nothing works as far as reading
    from the cell, absolute values do work, so the connection is good but that's not what I want.
    Kevin

  2. #2
    Forum Guru Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,023

    Re: Want to use Excel column cells as parameters to SQLSERVER query

    Not all forums are the same - seek and you shall find

  3. #3
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: Want to use Excel column cells as parameters to SQLSERVER query

    Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!

    Read this to understand why we ask you to do this
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0