• Guys,

    is it possible to use table variabel in dynamic sql, for example how to make this query works ?

    DECLARE @xyz TABLE (

    CustID varchar(50),

    CustName varchar(50)

    )

    insert into @xyz (CustID, Custname) VALUES ('1','Name 1')

    insert into @xyz (CustID, Custname) VALUES ('2','Name 2')

    insert into @xyz (CustID, Custname) VALUES ('3','Name 3')

    EXEC sp_executesql N'SELECT * FROM @xyz'