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 > patindex function
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
patindex function

Réponse
 
LinkBack Outils de la discussion
Vieux 08/09/2008, 16h47   #1
tulip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut patindex function

can anyone explain to me what does this patindex('%,[0-9][0-9],',note) means?
i saw the patindex () normally take %pattern%, with % front and end, but this
one doesn't, so what could that means? the note field is like this , "
,L101,A101,01, "

thanks

  Réponse avec citation
Vieux 08/09/2008, 16h58   #2
Roy Harvey (SQL Server MVP)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: patindex function

On Mon, 8 Sep 2008 07:47:01 -0700, tulip
<tulip@discussions.microsoft.com> wrote:

>can anyone explain to me what does this patindex('%,[0-9][0-9],',note) means?


To match the string must end with a comma, followed by any two digits,
and then another comma. Before that there can be anything, or
nothing.

% is of course a wildcard that matches any string, or no string at
all. [0-9] matches a single character in the range 0 to 9. The
commas require the comm character in that position.

>i saw the patindex () normally take %pattern%, with % front and end, but this
>one doesn't, so what could that means? the note field is like this , "
>,L101,A101,01, "


If the trailing blank in that string is really part of the note column
then I would not expect it to match. T0 match the patindex shown the
column has to end with a comma, not a blank.

Roy Harvey
Beacon Falls, CT
  Réponse avec citation
Vieux 08/09/2008, 17h29   #3
tulip
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: patindex function

the note string is ",L101,A101,01,", the result return 11.


"Roy Harvey (SQL Server MVP)" wrote:

> On Mon, 8 Sep 2008 07:47:01 -0700, tulip
> <tulip@discussions.microsoft.com> wrote:
>
> >can anyone explain to me what does this patindex('%,[0-9][0-9],',note) means?

>
> To match the string must end with a comma, followed by any two digits,
> and then another comma. Before that there can be anything, or
> nothing.
>
> % is of course a wildcard that matches any string, or no string at
> all. [0-9] matches a single character in the range 0 to 9. The
> commas require the comm character in that position.
>
> >i saw the patindex () normally take %pattern%, with % front and end, but this
> >one doesn't, so what could that means? the note field is like this , "
> >,L101,A101,01, "

>
> If the trailing blank in that string is really part of the note column
> then I would not expect it to match. T0 match the patindex shown the
> column has to end with a comma, not a blank.
>
> Roy Harvey
> Beacon Falls, CT
>

  Réponse avec citation
Vieux 08/09/2008, 18h42   #4
Roy Harvey (SQL Server MVP)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: patindex function

On Mon, 8 Sep 2008 08:29:00 -0700, tulip
<tulip@discussions.microsoft.com> wrote:

> >can anyone explain to me what does this patindex('%,[0-9][0-9],',note) means?


>the note string is ",L101,A101,01,", the result return 11.


Yes, that is what it returns for me to. That is the start position of
the ',01,' at the end of the string. Note that it will always either
match the last four characters, or not match at all, so if it does
match the value returned will be LEN(note) - 3.

Roy Harvey
Beacon Falls, CT
  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 07h44.


É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,08534 seconds with 12 queries