Wednesday, March 7, 2012

Execute Sql Statement Stored in Table Type Variable

hi,

I Wrote one stored procedure in which i declare one variable as Table
then i stored in that table type variable
select
*
from
emp
so now my table contain one sql statement by 4 rows
now i want to execute the sql statement how (MS SQL SERVER 2000)

Actually my Query Contain more than 15,000 characters.hi
Just In the end of your Storedprodure type
print @.your SQl Statment|||

Quote:

Originally Posted by hisham123

hi,

I Wrote one stored procedure in which i declare one variable as Table
then i stored in that table type variable
select
*
from
emp
so now my table contain one sql statement by 4 rows
now i want to execute the sql statement how (MS SQL SERVER 2000)

Actually my Query Contain more than 15,000 characters.


Hi,
select the four rows in to four variables @.a,@.b,@.c,@.d,
remember while assigning you have to put the row values in single quotes
then execute the query by using this technic
[CODE]
exec(@.a+' '+@.b+' '+@.c+' '+@.d)

No comments:

Post a Comment