B
B. Meincke
I have a csv text data that contains address information that has been
concatenated in an external query and imported into our database using the
TransferText method. The problem is that some of the records include PO box
numbers and Unit numbers so the addr_line2 field value contains a comma. This
ends up splitting the field into two and opening the first field with a
quotation mark and closing the second field with a quotation mark. I hope
this makes sense.
For example:
(addr_line2 in the source query)
123 Somewhere Street
becomes...
(addr_line1 in the destination query) (addr_line2)
123 Somewhere Street (is null)
(addr_line2 in the source query)
456 Nowhere Street, Unit 789
becomes...
(addr_line1 in the destination query) (addr_line2)
"456 Nowhere Street Unit 789"
Long story short, how the text is imported is out of my hands, but is there
any way I can write an UPDATE query that would select the records with
quotation marks in the address fields and strip the quotation marks off the
affected values?
I read a thread here that suggests a way to concatenate the addition of
Chr(34) and I understand the syntax behind that (although not the reason for
wanting to do it) and I've tried using the following:
UPDATE tblData
SET addr_line1 = addr_line1-Chr(34);
But that reports an error.
Any suggestions or advice would be appreciated. Thanks in advance.
concatenated in an external query and imported into our database using the
TransferText method. The problem is that some of the records include PO box
numbers and Unit numbers so the addr_line2 field value contains a comma. This
ends up splitting the field into two and opening the first field with a
quotation mark and closing the second field with a quotation mark. I hope
this makes sense.
For example:
(addr_line2 in the source query)
123 Somewhere Street
becomes...
(addr_line1 in the destination query) (addr_line2)
123 Somewhere Street (is null)
(addr_line2 in the source query)
456 Nowhere Street, Unit 789
becomes...
(addr_line1 in the destination query) (addr_line2)
"456 Nowhere Street Unit 789"
Long story short, how the text is imported is out of my hands, but is there
any way I can write an UPDATE query that would select the records with
quotation marks in the address fields and strip the quotation marks off the
affected values?
I read a thread here that suggests a way to concatenate the addition of
Chr(34) and I understand the syntax behind that (although not the reason for
wanting to do it) and I've tried using the following:
UPDATE tblData
SET addr_line1 = addr_line1-Chr(34);
But that reports an error.
Any suggestions or advice would be appreciated. Thanks in advance.