2010-05-12 8 views

Répondre

1
SELECT description = CASE 
    WHEN LEN(description) > 30 THEN SUBSTRING(description, 1, 30) + '...' 
    ELSE description 
END 
FROM table 
0

SELECT LEFT (description, 30) selon la description à partir de la table

+0

comment concat '' .... chaîne ... –

+0

SELECT GAUCHE (description, 30) + '.....' que la description FROM table – RandyMorris

0

Utiliser un CASE statement; quelque chose comme:

SELECT 
    CASE WHEN CHAR_LENGTH(description) > 30 
    THEN SUBSTRING(description,1,30) + '.....' 
    ELSE description 
    END as description 
FROM 
    table