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 |
|
jscot
Posting Yak Master
106 Posts |
Posted - 2011-02-26 : 21:12:01
|
| Hi Guys, I have question regarding Trim function, Here is my requirement, Address = ADDRESS1+ADDRESS2+ADDRESS3I want to trim if there is no Address1 or Address3I know i can use Ltrim & Rtrim function, Could you please anyone can help me how i can use trim function in TSql and SSIS. Thanks in advance. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
jscot
Posting Yak Master
106 Posts |
Posted - 2011-02-27 : 00:40:19
|
| i am using ISNULL function, if there is Null convert to "Blank" so i want to remove empty spaces. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-02-27 : 03:51:06
|
quote: Originally posted by jscot i am using ISNULL function, if there is Null convert to "Blank" so i want to remove empty spaces.
can you show us your query on the isnull() ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mandm
Posting Yak Master
120 Posts |
Posted - 2011-02-28 : 16:27:45
|
| When you say you're converting isnull to blank do you mean a single space as in ' '? If so why not just convert it to empty string instead? Then you don't need to worry about trimming the spaces. |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-03-01 : 10:32:51
|
| 1) You dont need to Trim the addresses if there are NULL Values in them .. simply use Address = isNULL(ADDRESS1,'')+isNULL(ADDRESS2,'')+isNull(ADDRESS3,'')2) if there are chances of leading/trailing spaces in the Address columns then you can use: Address=isnull(ltrim(rtrim(address1)),'')+isnull(ltrim(rtrim(address2)),'')+isnull(ltrim(rtrim(address3)),'')CheersMIK |
 |
|
|
|
|
|
|
|