Click here to monitor SSC
SQLServerCentral is supported by Redgate
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
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, November 21, 2016 1:31 AM
Points: 40, Visits: 262
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



Group: General Forum Members
Last Login: Yesterday @ 12:29 PM
Points: 17,173, Visits: 32,140
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 Query Performance Tuning
SQL Server Execution Plans

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

Add to briefcase

Permissions Expand / Collapse