Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Posts
    58

    Question Unanswered: OPENQUERY Parameter

    I am trying to do the following:

    SELECT ExpireDate
    FROM OPENQUERY([10.22.10.79], Expire Date
    From Product Where [ExpireDate] > 2005-12-31')
    GO

    However the above sql statement doesn't get the dates greater than the date provided unless there are quotes around the date. How do I add a variable that will cover this date and include the identifiers to get the correct records

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Try this:
    SELECT ExpireDate
    FROM OPENQUERY([10.22.10.79], 'select Expire Date From Product Where [ExpireDate] > ''2005-12-31''')
    GO
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Oct 2005
    Posts
    58
    I thought I did already try that. Let me double check...

  4. #4
    Join Date
    Oct 2005
    Posts
    58
    This gives me an "Invalid Column Name" error.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Chang "Expire Date" to "ExpireDate":
    SELECT ExpireDate
    FROM OPENQUERY([10.22.10.79], 'select ExpireDate From Product Where [ExpireDate] > ''2005-12-31''')
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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