Thursday, August 1, 2013

Rewriting scalar function to table function


Hi,


I have just re-written a scalar fuction to a table fucntion, however there is a small problem. Within the scalar function, there is a section where the return value is set to null, this means that if no value gets assigned to it within function logic, it will return null. It is however proving problematic transferring thesame login to a table function since I cannot assign variables.


I need a way to check whereby if the select statement returns nothing from inline query, then simply return null. Is there a built in SLQ function similar to isnull that can do this ?



You can also use Case, iif to detect null and to further return values. Read


http://msdn.microsoft.com/en-us/library/ms181765.aspx


http://msdn.microsoft.com/en-us/library/hh213574.aspx




Many Thanks & Best Regards, Hua Min



No comments:

Post a Comment