SQL Server stored procedure issue calling another stored procedure -


Here I have a stored procedure (using SQL Server 2005), stored within this stored procedure and another stored in this stored procedure. Procedure puts data in a temporary table. Insert it into #tmpTable (column1, column2, column3) EXEC psp_rptInsideStoredprocedure 2

This stored procedure has a mode parameter defined within it Which columns are passed in this mode (mode 2) only 3 columns are passed, when the stored stored procedure is used for any other report (mode 1) 4 columns are passed Are there. Sometimes parents complain about trying to insert the stored procedure 4 columns and sometimes it does not.

I know that it is always going through 2 modes, but it seems that SQL Server knows that sometimes 4 columns have been returned in this archived process.

Any ideas on the solution?

thanks

don

hair process is always the same Return the number and type the column, if necessary, use zero if the results are very different for two versions, then you can not add them in this way, you should consider making two separate processes.

I'm just guessing on your process, but you populate a #ResultSet Temp table and it according to your type parameter, but always return all the columns. Etc. If you are returning to many rows, it gets spoiled, because the temp table is overhead. In that case, just make sure that your result set will return the number of columns:

  if selection from call 1, cola 2, tap ... in the @ version = 1 ... end Select Start in COL1, col2, col3 FROM ... WHERE ... END  

Then when both parents call it, accept all the columns, but they ignore those things They do not need them. / P>


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -