开发者

SQL Server adding values

开发者 https://www.devze.com 2023-01-09 18:35 出处:网络
SELECT @s = ISNULL(@s + \'开发者_Python百科. \' , \'\') + [Comments] FROM [Customer] RETURN @s How can I catch Null or \'\', so that if its either It Won\'t append to the string and not add a \'.\'

SELECT @s = ISNULL(@s + '开发者_Python百科. ' , '') + [Comments] FROM [Customer]

RETURN @s   

How can I catch Null or '', so that if its either It Won't append to the string and not add a '.'

Thanks

Jacob


SELECT
    @s = ISNULL(NULLIF(@s, '') + '.', '') + comments
FROM
    [Customers]

RETURN @s
0

精彩评论

暂无评论...
验证码 换一张
取 消