Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE #three
- (
- colA varchar(32),
- colB varchar(32)
- );
- INSERT #three(colA, colB) VALUES
- ('abc', 'xyz'),
- ('def', NULL),
- (NULL, 'ghi'),
- (NULL, NULL);
- SELECT ColA, ColB,
- ColC = LTRIM(COALESCE(colA, '') + COALESCE(' '+colB,''))
- FROM #three;
- DROP TABLE #three;
- ColA ColB ColC
- ---- ---- -------
- abc xyz abc xyz
- def NULL def
- NULL ghi ghi
- NULL NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement