Wednesday, March 7, 2012

pass hash (#) table with different structure to stored procedure

Dear Techies,

I making one stored procedure, which does some operation based on an
interface hash (#) table -- name #mydata.

This stored has two section of code (seperated by parameter value 0
and 1)
But hash table #mydata (same name) number/name of columns changes as
per call 0 or 1.

e.g.
when call for 0, --> Pass 2 columns as company_cd and section_cd in
interface hash (#) table -- name #mydata.
when call for 1, --> Pass 3 columns as Section_cd, line_cd and
subline_cd in interface hash (#) table -- name #mydata.

As a result, none of the case (0 or 1) is running properly, It gives
problem.

When I execute procedure for 0 by passing #mydata with two columns
--> it gives problem in 1 section code

And When I execute procedure for 1 by passing #mydata with three
columns --> it gives problem in 0 section code

Please suggest !!! If anybody have faced the same problem or have any
idea about this case.
(I think passing hash table with 3 column as col1,col2,col3 can serve
the purpose, but this may cause rework in my case, so looking for
alternate solution)

Thanks in Advance,
T.S.NegiIt sounds like creating the temp table with all three columns is
probably the best solution - see here for more details and other
options:

http://www.sommarskog.se/share_data.html

Simon

No comments:

Post a Comment