table joins

  • Can anyone tell me how (if it's possible) to join a permanent database table to a table variable?

  • Table variables can be treated a great deal like tables (with some exceptions).

    DECLARE@tablevarTABLE (

    idcolumnint

    ,column3nvarchar ( 50 )

    )

    ... later...

    SELECTx.column1, x.column2, y.column3

    FROMdbo.table1 x

    JOIN@tablevar y

    ONx.idcolumn = y.idcolumn

  • Thanks, Aaron; appreciate the help. I was unaware, until very recently, that I had to use the table variable alias in the JOIN statement. 

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

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