moving on from my problem earlier I now have a slightlty similar one.
I have table and data similar to this;
ID Address
1 1 first ave
widnes
Cheshire
2 -----extra unwanted carriage return
2 First Ave
widnes
Cheshire
The addess is allowed carriage returns but I want to delete the blank line (extra carriage return) at the start of the address.
My syntax is:-
Update MyTable
set address = REPLACE ( address , (charindex (CHAR(13)=1),t2.a_name),'')
FROM MyTable
where charindex (CHAR(13),address) = 1
I'm sure you can see the problem with the =1 in the set statement. how do I delete the line but keep the others?
Also do I need to replace CHAR(13)+CHAR(10) or would that screw up the 2nd line in the address which contain legitimate data?
Cheers
I have table and data similar to this;
ID Address
1 1 first ave
widnes
Cheshire
2 -----extra unwanted carriage return
2 First Ave
widnes
Cheshire
The addess is allowed carriage returns but I want to delete the blank line (extra carriage return) at the start of the address.
My syntax is:-
Update MyTable
set address = REPLACE ( address , (charindex (CHAR(13)=1),t2.a_name),'')
FROM MyTable
where charindex (CHAR(13),address) = 1
I'm sure you can see the problem with the =1 in the set statement. how do I delete the line but keep the others?
Also do I need to replace CHAR(13)+CHAR(10) or would that screw up the 2nd line in the address which contain legitimate data?
Cheers