Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Analyzer
Posting Yak Master
115 Posts |
Posted - 2015-04-09 : 11:51:13
|
Hi,Trying to concatenate 2 variables without a space. Tried ++, coallese, RTRIM, LTRIM and all fail. Delare @schema char(4), @tbl vchar(10)Set @schema = 'test.', @tbl = 'results'Select @schema ++ @tblResult I get is test. Results Trying to build a string to import data so cannot have that space. Any ideas? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Kristen
Test
22859 Posts |
Posted - 2015-04-09 : 13:03:18
|
[code]Select RTrim(@schema) + @tbl[/code]??Your issue is probably that @schema is decalred as CHAR (which is fixed length, and thus will be space padded)... notwithstanding that your example declared it as CHAR(4) which is shorter than the sample data 'test.' ... plus a few other typos.Here's my test code[code]Declare @schema char(10), @tbl varchar(10)SELECT @schema = 'test.', @tbl = 'results'Select RTrim(@schema) + @tbl[/code] |
|
|
|
|
|