query problem

  • hello,

    this is my query

    select convert(c.evs_OrderIDid as UNIQUEIDENTIFIER) , convert(b.ORdernumber as UNIQUEIDENTIFIER) from evs_ccagentCodes c

    left join [salesorder] b on c.evs_OrderIDid = b.ORdernumber

    its giving me this error

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'UNIQUEIDENTIFIER'.

    please help me out

    immad

  • Change CONVERT to CAST

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537
  • still giving m error

    immad

  • What's your query now?

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537
  • select cast(c.evs_OrderIDid as UNIQUEIDENTIFIER) , cast(b.ORdernumber as UNIQUEIDENTIFIER) from evs_ccagentCodes c

    left join [salesorder] b on c.evs_OrderIDid = b.ORdernumber

    immad

  • What error are you getting now?

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537
  • Anything that is not in the form of: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx where x is a hexadecimal value (e.g. 0-9 A-F) is going to fail... are c.evs_OrderIDid and b.ORdernumber formatted like that?

    why do you need to make this conversion? Seems odd that you would need to do that...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 7 posts - 1 through 6 (of 6 total)

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