Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a shorter syntax?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00510693
Message ID:
00510700
Vues:
19
>>Hey, whatever works... But, you may want to look at datepart and convert...
>>
>>SELECT left(convert(datetime,TB.Date,111),7) as Date, ...
>>WHERE ...
>>GROUP BY datepart(yyyy, TB.date), datepart(mm, TB.date)
>>
>>>
>>>I want the output to be yyyy/mm.
>
>
>The result is displaying "Apr 2 " and I want 2001/04

May this can help. If I do a "SELECT convert(datetime,TB.Date,111) as Date, ", I see "2001-04-02 00:00:00.000" displayed. Why the Left statement simply returns the 7 left characters?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform