Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a shorter syntax?
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00510693
Message ID:
00510700
Views:
18
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform