I want to concatenate the words "dummy's" and "dock".
How can I concatenate them in SQL Server 2005? Does it support double quotes?
Try this:
DECLARE @COMBINED_STRINGS AS VARCHAR(50); -- Allocate just enough length for the two strings. SET @COMBINED_STRINGS = 'rupesh''s' + 'malviya'; SELECT @COMBINED_STRINGS; -- Print your combined strings.
Or you can put your strings into variables. Such that:
DECLARE @COMBINED_STRINGS AS VARCHAR(50), @STRING1 AS VARCHAR(20), @STRING2 AS VARCHAR(20); SET @STRING1 = 'rupesh''s'; SET @STRING2 = 'malviya'; SET @COMBINED_STRINGS = @STRING1 + @STRING2; SELECT @COMBINED_STRINGS;
Output:
rupesh'smalviya
Just add a space in your string as a separator.
so if you have a table with a row like:
firstname lastname Bill smith
you can do something like
select firstname + ' ' + lastname from thetable
and you will get "Bill Smith"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With