Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exporting to Excel
Message
From
11/10/2021 17:07:31
 
 
To
11/10/2021 11:26:05
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01682467
Message ID:
01682481
Views:
42
In other thread branch this was described as not working.
>CHAR(34)+REPLACE(Table.Field,CHAR(13)+CHAR(10),CHAR(10))+CHAR(34)

Which I still cannot fathom - unless there is something weird in the replace return (type)

This is your wish:
>... but, I need to REPLACE quotes inside the content with a blank so it won't affect the delimiters. I still don't understand why this didn't work in the first place. Now, it does.

You wrote quotes but probably meant double quotes
*-- using vfp square brackets as string delimiter to force the point, so  CHR(), not CHAR()
CHR(34) == ["]
CHR(39) == [']
, so try

CHAR(34)+RTrim(REPLACE(Table.Field,CHAR(34),CHAR(32)))+CHAR(34)
if
CHAR(34)+REPLACE(Table.Field,CHAR(34),CHAR(32))+CHAR(34)
does not work AND you aim for eliminating double quotes you are setting as front and end chars

for a single instance of double quote
CHAR(34)+stuff(Table.Field,CHARINDEX(CHAR(34)),1,CHAR(32))+CHAR(34)
should do it - IIRC the StrPos of C# and Postgres was CHARINDEX(). in T-SQL

Of course for debugging CHAR(64) or something similar as temp replacement might jump into your eyes faster than CHAR(32)
;-)

>>Come on, permutating the workable T-SQL should not take long
>>give us a clue what differentiates working and not working solutions
>
>CHAR(34)+substring(" " +Table.Field, 2, 999999)+CHAR(34)
>
>Works
>
>CHAR(34)+rtrim(Table.Field)+CHAR(34)
>
>Works
>
>CHAR(34)+cast(Table.Field as ...)+CHAR(34)
>
>Works
>
>CHAR(34)+stuff(Table.Field, with no working, "whatever")+CHAR(34)
>
>Can't make this one work.
>
>CHAR(34)+stuff(Table.Field, working, "whatever")+CHAR(34)
>
>Can't make this one work.
>
>CHAR(34)+Table.Field+CHAR(34)
>
>Also works and simpler, but, I need to REPLACE quotes inside the content with a blank so it won't affect the delimiters. I still don't understand why this didn't work in the first place. Now, it does.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform