Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VAL() type of function?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00825781
Message ID:
00825790
Vues:
28
Would this work for you?
DECLARE @pn varchar(15)
SET @pn = 'FLR-142A'
SELECT 
	CAST(
		CASE WHEN RIGHT(SUBSTRING(@pn, CHARINDEX('-', @pn)+1,15),1) <= '9'
			THEN SUBSTRING(@pn, CHARINDEX('-', @pn)+1,15) ELSE 
				LEFT(SUBSTRING(@pn, CHARINDEX('-', @pn)+1,15), 
LEN(SUBSTRING(@pn, CHARINDEX('-', @pn)+1,15))-1) END 
	AS int)
>Thanks Serg.
>
>select Cast(right(rtrim(pa_page),3) AS int) AS 'value',
>* from deppage
>
>errors on :
>Syntax error converting the varchar value 'O-8' to a column of data type int.
>
>I have lots of Embedded #'s in this column. XXX-NNNX or XX-NN or XXX-NNX
>
>Maybe a union to pull from the 3 NNN #'s as well as the primary 2 NN #'s?
>
>I'm still getting Whacked by the occassional last Letter?
>
>
>__Stephen
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform