Wednesday, February 15, 2012

Dynamic SQL help

I am trying to create a cursor that gathers a tag value and column name
for use in a sp_execute sql statement. The text is as below
SET @.qry = N'SELECT @.tag_value_out = ' +
CONVERT(nvarchar(25),@.column_name) + N' FROM FSFORMULA WHERE formula_id
= @.formula_id_in'
But when I use PRINT on the next line, nothing is printed out.
@.qry is nvarchar(1000)
Any help? This is in a stored procedure.if @.column_name is null it will return null
<cknobs@.gmail.com> wrote in message
news:1143835555.976735.287650@.g10g2000cwb.googlegroups.com...
>I am trying to create a cursor that gathers a tag value and column name
> for use in a sp_execute sql statement. The text is as below
> SET @.qry = N'SELECT @.tag_value_out = ' +
> CONVERT(nvarchar(25),@.column_name) + N' FROM FSFORMULA WHERE formula_id
> = @.formula_id_in'
> But when I use PRINT on the next line, nothing is printed out.
> @.qry is nvarchar(1000)
> Any help? This is in a stored procedure.
>|||it was, turns out i didn't have the @.column_name variable in the fetch
next statement. DERP!
thx!

No comments:

Post a Comment