Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

selection from db table using function or sp. Expand / Collapse
Author
Message
Posted Wednesday, August 29, 2012 2:35 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, April 14, 2014 1:32 AM
Points: 35, Visits: 161
Can we do the selection from the Database table by creating the Table Value Function. Or shall we create the sp for that. which is better approach for performence point of view.
Post #1351469
Posted Wednesday, August 29, 2012 4:48 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:48 AM
Points: 14,802, Visits: 27,278
It really depends on what you're trying to do. The basic table valued function's nickname is parameterized view. These functions work pretty well on their own. They can be somewhat problematic if you try to treat them like a real table and join them or nest them (just like views). Where people frequently run into problems is with the multi-statement table valued user defined functions. These are very problematic constructs from a performance standpoint and you should be very careful about their use.

In general, if you don't have a need for the table valued function, I'd just use a regular old stored procedure.


----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1351511
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse