Hi To all
This is nice article , i worked lot on Table Variable and know all it's + and -
there is a restriction on Table Variable that we cannot use EXEC and string query on table variable.
Can any one give me the right Alternative how i insert Dynamic query result into Table Variable . I don't Want to Use # Table or ## table.
my problem is like that.
DECLARE @shashi(PRIMARY_KEY INT NOT NULL, NAME VARCHAR(50))
DECLARE @SSQL AS STRING, @CHECK AS INT
SET @CHECK = 1
SET @SSQL = 'SELECT ID , NAME FROM MY_TABLE'
IF @CHECK = 1
SET @SSQL = @SSQL + 'WHERE ID >25'
ELSE
SET @SSQL = @SSQL + 'WHERE ID <25'
INSERT INTO @shashi
----------------------HOW I USE THE DYNAMIC QUERY TO INSERT VALUES INTO MY @shashi TABLE. CAN ANY ONE EXPERT SOLVE MY PROBLEM WITHOUT USING TEMP TABLE........
THANKS IN ADVANCE........HOPPING URGENT REPLY.........