Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
From 112 to DATEPART
Message
De
24/01/2011 20:58:57
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
From 112 to DATEPART
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01497298
Message ID:
01497298
Vues:
91
I have this:
SELECT CONVERT(CHAR(8),Hit.AddDate,112)
It is good to return a 20110124 syntax. Now, I have another situation where I have pretty much the same query but I need to add two additional digits representing the hour. Basically, it goes like this:
SELECT CONVERT(CHAR(4),YEAR(Hit.AddDate))+REPLACE(STR(MONTH(Hit.AddDate),2),' ','0')+
 REPLACE(STR(DAY(Hit.AddDate),2),' ','0')+REPLACE(STR(DATEPART(HOUR,Hit.AddDate),2),' ','0')
What would be the replacement of 112 to obtain a syntax like 2011012412, which would represent the 12th hour for example.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform