• shalini72011 (11/7/2011)


    Hi,

    I have a query with update statement

    UPDATE #Rpt

    SET Productfamily = PD.pt_sp_type_c

    FROM #Rpt s

    INNER JOIN #ProductDetails PD on PD.pt_sb_type_c = s.CONVERT(VARCHAR(10),productId) --03112011

    here pt_sp_type_c and pt_sb_type_c both are varchar(10) and productId is integer

    so when i am trying to execute teh query its showing that cannot convert varchar to int..i am changing productId to varchar for that i am using

    cast and convert for me its showing incorrect syntax near the keyword convert

    whern i use cast s.CAST(productId AS VARCHAR(10)) --here its showing incorrect syntax near keyword AS can anyone come with appropraite answer..

    And what is the data-type of ProductFamily?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)