Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-01-14 : 22:28:14
|
mala writes "Hi,
I have to execute a procedure where column name changes in loop (array processing). Within procedure I have set of Commands similar to this : declare @i char(8) declare @m char(10) declare @k char(1) set @i = 'ord_Ref" set @i = rtrim(@i) + @k [withing loop @k values changes] declare @v_str char(10) set @v_str='abc' set @v_str = rtrim(@v_Str) declare @j char(1000) set @j = "if exists (select " + @i + " from t_ord_header where " + @i + "= '" + @v_Str + "' ) set " + @m + "= 'a'" exec(@j) print @m
Now depending on @m value I have to proceed for further validation. But This query does not execute. [but does not give error also]
If I replcate set @j with "if exists (select " + @i + " from t_ord_header where " + @i + "= '" + @v_Str + "' ) print 'a'" it prints 'a' if record existing.
Please quide me how do I retrieve @m value.
Awaiting with anticipation.
Bye,
Mala" |
|
|
|
|
|