PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.sqlserver.server > TSQL - Carriage control characters
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
TSQL - Carriage control characters

Réponse
 
LinkBack Outils de la discussion
Vieux 14/07/2008, 15h41   #1
DXC
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut TSQL - Carriage control characters

SQL Server 2000 SP4.
I have this problem. I have a text column coming out in Some data Extract
for a client.
They need us to remove (replace) the carriage control characters in the
extract.
'--- vbCrLf & Chr(9)
I cannot convert to varchar because it will not fit.
What's my alternative.

Thanks for any
  Réponse avec citation
Vieux 14/07/2008, 16h13   #2
Roy Harvey (SQL Server MVP)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: TSQL - Carriage control characters

declare @x varchar(30)
SET @x = 'banana' + char(13) + char(10) + 'split'
SELECT @x, REPLACE(@x, char(13) + char(10), '??')

------------------------------ --------------------------------------
banana
split banana??split

Roy Harvey
Beacon Falls, CT

On Mon, 14 Jul 2008 06:41:02 -0700, DXC
<DXC@discussions.microsoft.com> wrote:

>SQL Server 2000 SP4.
> I have this problem. I have a text column coming out in Some data Extract
>for a client.
>They need us to remove (replace) the carriage control characters in the
>extract.
>'--- vbCrLf & Chr(9)
>I cannot convert to varchar because it will not fit.
>What's my alternative.
>
>Thanks for any

  Réponse avec citation
Vieux 14/07/2008, 16h27   #3
DXC
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: TSQL - Carriage control characters

Thanks for the quick response Roy but Replace does not work on text fields.



"Roy Harvey (SQL Server MVP)" wrote:

> declare @x varchar(30)
> SET @x = 'banana' + char(13) + char(10) + 'split'
> SELECT @x, REPLACE(@x, char(13) + char(10), '??')
>
> ------------------------------ --------------------------------------
> banana
> split banana??split
>
> Roy Harvey
> Beacon Falls, CT
>
> On Mon, 14 Jul 2008 06:41:02 -0700, DXC
> <DXC@discussions.microsoft.com> wrote:
>
> >SQL Server 2000 SP4.
> > I have this problem. I have a text column coming out in Some data Extract
> >for a client.
> >They need us to remove (replace) the carriage control characters in the
> >extract.
> >'--- vbCrLf & Chr(9)
> >I cannot convert to varchar because it will not fit.
> >What's my alternative.
> >
> >Thanks for any

>

  Réponse avec citation
Vieux 14/07/2008, 21h47   #4
TheSQLGuru
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: TSQL - Carriage control characters

SUBSTRING does work on text IIRC, and inconjunction with patindex you should
be able to do what you need to do.

Also, if they are small text fields you can also first convert to varchar
and then process as Roy suggested. If they are large you will need to do
them in chunks of 8000 or so at a time.

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"DXC" <DXC@discussions.microsoft.com> wrote in message
news:8DBA6441-4B6A-4D34-8828-EF518A28889A@microsoft.com...
> Thanks for the quick response Roy but Replace does not work on text
> fields.
>
>
>
> "Roy Harvey (SQL Server MVP)" wrote:
>
>> declare @x varchar(30)
>> SET @x = 'banana' + char(13) + char(10) + 'split'
>> SELECT @x, REPLACE(@x, char(13) + char(10), '??')
>>
>> ------------------------------ --------------------------------------
>> banana
>> split banana??split
>>
>> Roy Harvey
>> Beacon Falls, CT
>>
>> On Mon, 14 Jul 2008 06:41:02 -0700, DXC
>> <DXC@discussions.microsoft.com> wrote:
>>
>> >SQL Server 2000 SP4.
>> > I have this problem. I have a text column coming out in Some data
>> > Extract
>> >for a client.
>> >They need us to remove (replace) the carriage control characters in the
>> >extract.
>> >'--- vbCrLf & Chr(9)
>> >I cannot convert to varchar because it will not fit.
>> >What's my alternative.
>> >
>> >Thanks for any

>>



  Réponse avec citation
Vieux 15/07/2008, 14h56   #5
DXC
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: TSQL - Carriage control characters

Thanks......................




"TheSQLGuru" wrote:

> SUBSTRING does work on text IIRC, and inconjunction with patindex you should
> be able to do what you need to do.
>
> Also, if they are small text fields you can also first convert to varchar
> and then process as Roy suggested. If they are large you will need to do
> them in chunks of 8000 or so at a time.
>
> --
> Kevin G. Boles
> Indicium Resources, Inc.
> SQL Server MVP
> kgboles a earthlink dt net
>
>
> "DXC" <DXC@discussions.microsoft.com> wrote in message
> news:8DBA6441-4B6A-4D34-8828-EF518A28889A@microsoft.com...
> > Thanks for the quick response Roy but Replace does not work on text
> > fields.
> >
> >
> >
> > "Roy Harvey (SQL Server MVP)" wrote:
> >
> >> declare @x varchar(30)
> >> SET @x = 'banana' + char(13) + char(10) + 'split'
> >> SELECT @x, REPLACE(@x, char(13) + char(10), '??')
> >>
> >> ------------------------------ --------------------------------------
> >> banana
> >> split banana??split
> >>
> >> Roy Harvey
> >> Beacon Falls, CT
> >>
> >> On Mon, 14 Jul 2008 06:41:02 -0700, DXC
> >> <DXC@discussions.microsoft.com> wrote:
> >>
> >> >SQL Server 2000 SP4.
> >> > I have this problem. I have a text column coming out in Some data
> >> > Extract
> >> >for a client.
> >> >They need us to remove (replace) the carriage control characters in the
> >> >extract.
> >> >'--- vbCrLf & Chr(9)
> >> >I cannot convert to varchar because it will not fit.
> >> >What's my alternative.
> >> >
> >> >Thanks for any
> >>

>
>
>

  Réponse avec citation
Vieux 15/07/2008, 18h48   #6
Aaron Bertrand [SQL Server MVP]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: TSQL - Carriage control characters

What runs the extract? If you pull the data into a client language first
(VBScript, C#, VB.Net, etc) you can easily handle replace() before writing
to the file, and without having to deal with the limitations of TEXT.


On 7/14/08 9:41 AM, in article
7689CD4A-47FD-41B2-A5BB-495D86070AB0@microsoft.com, "DXC"
<DXC@discussions.microsoft.com> wrote:

> SQL Server 2000 SP4.
> I have this problem. I have a text column coming out in Some data Extract
> for a client.
> They need us to remove (replace) the carriage control characters in the
> extract.
> '--- vbCrLf & Chr(9)
> I cannot convert to varchar because it will not fit.
> What's my alternative.
>
> Thanks for any


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h05.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15845 seconds with 14 queries