Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Substring
Message
De
14/08/2012 07:31:03
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Substring
Divers
Thread ID:
01550460
Message ID:
01550460
Vues:
79
What am i doing wrong here

scanfilename = 'TB20111031GADO11FTB220181z220182.tif'

select scanfilename,CHARINDEX('O11FTB',scanfilename)+6 as pos_start,
CHARINDEX('tif',scanfilename) as pos_end,
(CHARINDEX('tif',scanfilename)-CHARINDEX('O11FTB',scanfilename)) as diff
from scans where scanfilename like '%O11FTB%'

produces

scanfilename pos_start pos_end diff
TB20111031GADO11FTB220181z220182.tif 20 34 20

why am I not getting 34 - 20 so answer 14

Thanks
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform