views:

41

answers:

1

Hey all

I have a stored procedure sp that calls a table-valued function tvf. Sometimes I modify the tvf but when subsequently executing sp, the output from sp is the same as before the modification. It seems like it is cached or compiled or something. If I make some dummy change to the sp, then I get the right output of the sp.

Is there some way, I can overcome this problem? In Oracle it is possible to re-compile all stored procedures, but I haven't been able to figure out how to do this in SQL Server?

Any help is highly appreciated.

A: 

You can use sp_recompile to recompile a stored procedure but afaik, what you describe shouldn't happen.

Could you post the udf? Only scenario I can think of would be when the udf always returns the same result, regardless of input parameters.

Lieven
Thanks for you very prompt reply!The udf is rather involved, so I dont expect you to have the energy to actually look at it, but anyway here it is... oh, it was about 5000 characters too long to fit here :) I will see if I can reproduce this behaviour with some simpler example. But I am not making this up - I have observed it several times...Do I have to use sp_recompile for each stored procedure, or can I somehow make it recompile all my stored procedures?
Peter
I would use the output of *SELECT 'sp_recompile ' + name FROM sys.procedures* to recompile all stored procedures.
Lieven