Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unexpected concatenated fields
Message
 
 
À
12/03/2003 06:22:23
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00764678
Message ID:
00764741
Vues:
26
This message has been marked as the solution to the initial question of the thread.
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>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform