Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PADR
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Re: PADR
Divers
Thread ID:
01406912
Message ID:
01406918
Vues:
46
>>I'm trying to pull two columns with some space between:
>>
>>
>>
>>	SELECT	PartId, 
>>			PartInfo = PartNo + RIGHT(REPLICATE(' '), 20) + Description
>>		FROM Parts
>>		ORDER BY PartInfo
>>
>>
>>I'm getting 'Incorrect syntax near the keyword 'FROM'.'
>>
>>I got this example from http://www.sqlusa.com/bestpractices2005/padleadingzeros/
>
>You're missing ) after replicate. See correction inline.

Actually I figured it out after I posted. This is what I got:
SELECT	PartId, 
		PartNo + REPLICATE(' ', 20) + RIGHT(CAST(Description AS VARCHAR(100)), 100) PartInfo
	FROM Parts
	ORDER BY PartInfo
Thanks
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform