using stored procedure selected values with where clause on query
I created a stored procedure with table variable and inserted the values to the table vari开发者_C百科able and returned the table variable column and returns number of integer values.Now i need to select the records from a table depending on the returned result.
I echo Martin's request for clarification. However, if I get you correctly, you are saying you have a table variable with an int column and need to use this int column. Instead of having the stored procedure return the (variable) table's content, you can use the table variable in a JOIN statement together with the table that contains the data you're looking for.
Something like this:
Select * from sourcetable INNER JOIN @tablevariable MyVarTable ON sourcetable.intcolumn1 = Myvartable.intcolumn2
精彩评论