Friday, March 9, 2012

is there anyway to raise a warning from a UDF (in sql2000 and/or in SQL2005)

cos RAISERROR isnt callable, but I really want to indicate a non-fatal warning to be passed back to the client (C++ code)

You are limited to a single output either way dealing with a scalar or table valued function. The only way you could pass back a message of some sort would be to overwrite the scalar return value or add a column to your table return. Neither of those sound particulary appealing but you have few options.|||In SQL Server 2005, you could replace the TSQL UDF with CLR UDF and raise exception in your CLR code. But this is not a pretty implementation and depending on the TSQL code you will get worse performance. So best is to modify the UDF to a SP or just check for absence of row or special value like NULL.

No comments:

Post a Comment