2
是否可以創建一個返回可爲空字符串的SQL Server函數?在SQL Server函數中返回可爲空的類型
我想創造出返回DBNull如果值爲0或空字符串的函數:
Create FUNCTION [dbo].[SetDBNullNvarChar] (@input nvarchar(1000))
RETURNS (needs to be nullable)
AS
BEGIN
if (@input = '' OR @input = 0)
BEGIN
RETURN null
END
return @input
END
謝謝,我想太多的C#,在那裏你必須指定可空類型。 – Dofs 2009-06-30 18:11:45