About this SQL User defined function
This Function will return a null if the value of the field passed is blank..
CREATE FUNCTION dbo.FuncBlankToNull(@Input varchar(2000))
RETURNS varchar(2000) AS
BEGIN
Declare @Return as varchar(2000)
Set @Return = LTrim(RTrim(@Input))
if @Return = ''
Begin
Set @Return = Null
End
Return @Return
END
Example
dbo.FuncBlankToNull('') = Null
dbo.FuncBlankToNull('RAJ') ='RAJ'
No comments:
Post a Comment