Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unexpected concatenated fields
Message
De
13/03/2003 03:14:04
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00764678
Message ID:
00765273
Vues:
14
Thanks Sergey



>Mark,
>
>The default lenght for char and varchar in CAST is 30 characters. That what causes truncation in the fourh part of expression. Specifaing varchar lenght explicitly should fix it.
CAST(LEFT (RTRIM(dbo.[section].sect_desc), 25) + ' / ' +
>  LEFT (CAST(dbo.heading.head_desc AS VARCHAR), 25) + ' / ' +
>  LEFT (CAST(dbo.item.item_desc AS VARCHAR), 25) + ' / ' +
>  LEFT (RTRIM(CAST(dbo.subitem.sub_desc AS VARCHAR(50))), 50) AS varchar(600))
I prefer always specify lenght in char/varchar so I don't have to worry about defaults.
>
>>In the following expression
>>the field returned is truncated unexpectedly to 120 characters long.
>>
>>CAST(LEFT (RTRIM(dbo.[section].sect_desc), 25) + ' / ' + LEFT (CAST(dbo.heading.head_desc AS VARCHAR), 25) + ' / ' +
>>LEFT (CAST(dbo.item.item_desc AS VARCHAR), 25) + ' / ' + LEFT (RTRIM(CAST(dbo.subitem.sub_desc AS VARCHAR)), 50) AS varchar(600))
><snip>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform