![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi! I need to refresh an entire database. I can recompile SPs with sp_recompile (or DBCC FLUSHPROCINDB), and refresh views with sp_refreshView, but I cannot find any way to refresh my user-defined functions (some of them are like views, with parameters). |
#3
| |||
| |||
|
|
I can recompile SPs with sp_recompile (or DBCC FLUSHPROCINDB), and refresh views with sp_refreshView, but I cannot find any way to refresh my user-defined functions (some of them are like views, with parameters). |
#4
| |||
| |||
|
|
I need to refresh an entire database. So, all SPs, functions, and views. |
|
Ben (ben... (AT) gmail (DOT) com) writes: I can recompile SPs with sp_recompile (or DBCC FLUSHPROCINDB), and refresh views with sp_refreshView, but I cannot find any way to refresh my user-defined functions (some of them are like views, with parameters). What do you really want to achieve? sp_recompile and FLUSHPROCINDB just removes plans out the query cache. sp_refreshview on the other hand reinterprets the definition of the view, and this is necessary if the view definition has an * in the select list. Thus the two serve completely different purposes. IF the problem is that you cannot refresh your inline table functions, the simple solution is not to use SELECT *, which is generally considered bad practice. -- Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books... Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx |
#5
| |||
| |||
|
|
Hi Ben, Hi! I need to refresh an entire database. I can recompile SPs with sp_recompile (or DBCC FLUSHPROCINDB), and refresh views with sp_refreshView, but I cannot find any way to refresh my user-defined functions (some of them are like views, with parameters). I'm afraid that no such procedure/DBCC command exists to recompile a function. IMHO the best way to refresh function meta-data is to ALTER it. That's better solution than dropping and creating (recreating) a function, because when using ALTER FUNCTION permissions are retained. -- Best regards, Marcin Guzowskihttp://guzowski.info |
#6
| |||
| |||
|
|
I heard about the "select * is bad practice", but I'm dealing with a constantly evolving database (not yet in production), so I use a lot of it to just pump everything and send it back to webpages. And even if I didn't all that would mean is I'd have to manually go into every function and update them, which is exactly what I've been doing so far (open, backspace to alter, save --seems to be the only way to refresh). |
![]() |
| Thread Tools | |
| Display Modes | |
| |