Created
July 6, 2016 18:52
-
-
Save kevindb/02dde260366988dc95948643eb748162 to your computer and use it in GitHub Desktop.
SQL Server function to return NULL for blank columns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[f_nullForBlank] | |
( | |
@value VARCHAR(8000) | |
) | |
RETURNS VARCHAR(8000) | |
AS | |
BEGIN | |
RETURN NULLIF(LTRIM(RTRIM(@value)), '') | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment