Efficient nested query to query on string and fetch corresponding PK

  • Hello,

    The search text (not exact match) is in excel column and will be passed to sql query to fetch the data from database. I am using vba for querying the database. My sql description column sample is attached herewith.

    Thanks

    Attachments:
    You must be logged in to view attached files.
  • My first recommendation is not  to use Excel and VBA to pull data from the database (or push it in... I'm a little unclear on what is happening here) but instead to use SSIS or TSQL.

    That being said, I don't understand what you are trying to do.  Both of the attachments look like table data.  Not seeing anything that lists your DDL such as table structures.  And both documents appear identical.

    Could you provide DDL, expected output, and what you have tried?

    If both documents are supposed to be identical, I assume the data in both tables is identical, in which case I don't see the need for the "nested query".

    As you don't list any column names OR any PK's, I don't know what you are trying to do.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply