Jump to content

Help In Sql Query For Extract Hour In Timestamp From Column


Recommended Posts

Posted

[quote name='goli soda' timestamp='1362155958' post='1303349856']
dude yee problem solve ayinda? nuvvu sybase annavu... but extract command sybase lo ledu kada......
[/quote]

sybase annada... paina sql kada annadu???

Posted

[quote name='loveindia' timestamp='1362156294' post='1303349913']

sybase annada... paina sql kada annadu???
[/quote]

[quote name='ALFANI' timestamp='1362071011' post='1303344914']
I’m using below query… Getting month and date but not hour while extracting from table …throwing error
Hour line add cheyaganey An unexpected token "EXTRACT(month FROM DT_SVC_STARTD) "month", EXTRACT(day" was found following "SELECT ". Expected tokens may include: "<space>". SQLSTATE=42601
select extract(month from DT_SVC_STARTD) as mon,
extract(day from DT_SVC_STARTD) as dy,
--extract(Hour from DT_SVC_STARTD) as hh
count(DT_SVC_STARTD) as Trans
FROM UDBADM.RDSTMP where extract(year from DT_SVC_STARTD) > 2011
group by extract(month from DT_SVC_STARTD),extract(day from DT_SVC_STARTD)
--extract(Hour from DT_SVC_STARTD)
order by mon,dy;

[b]using rapidsql tool over sybase[/b]..datetime format "2011-12-11-07.56.07.651000"
need to figure out peak hour transaction from a year...year lo e month lo e date e hour lo inni trasactions jariginooo kavali
[/quote]

Posted

[quote name='loveindia' timestamp='1362076643' post='1303345294']
ela cheptaavu vayya alternative ani... takita takita takita 2 4.. takadimi takadimi 2 6.. aa tempo enti ee tempo enti.. aa query enti ee query enti.. :P (Just for fun)
[/quote]

Sql lo rendu Dates ni - Cheyyali antey eminaa function undaa inbuilt dates lo

Like '2012-01-01 23:01:01' - '2012-01-01 22:01:01' =? mins difference choopiyaali ila kaavali naaku

Posted

[quote name='DARLING...' timestamp='1362156460' post='1303349939']

Sql lo rendu Dates ni - Cheyyali antey eminaa function undaa inbuilt dates lo

Like '2012-01-01 23:01:01' - '2012-01-01 22:01:01' =? mins difference choopiyaali ila kaavali naaku
[/quote]

DATEDIFF ( minutes(ikkada neeku edi kaavalo adi pettochu), startdate , enddate )

Posted

[quote name='goli soda' timestamp='1362156350' post='1303349922']
[/quote]

atrutha ekkuva ayyi adi miss ayya... :P

Posted

[quote name='DARLING...' timestamp='1362156460' post='1303349939']
Sql lo rendu Dates ni - Cheyyali antey eminaa function undaa inbuilt dates lo

Like '2012-01-01 23:01:01' - '2012-01-01 22:01:01' =? mins difference choopiyaali ila kaavali naaku
[/quote]

USE THIS DARLING.....

[code]
DECLARE @start DATETIME = '2013-03-01 10:54:59.780', @end DATETIME = '2013-03-01 10:56:59.780'


SELECT '('+CONVERT(VARCHAR(MAX),@start, 121)+') - ('+CONVERT(VARCHAR(MAX),@end, 121)+') = '
+ CASE WHEN CAST(DATEDIFF(mi,@start,@end) AS VARCHAR(MAX)) = 1 THEN '1 Minute'
ELSE CAST(DATEDIFF(mi,@start,@end) AS VARCHAR(MAX))+ ' Minutes' END
[/code]

Posted

[quote name='loveindia' timestamp='1362074998' post='1303345199']
ee extract endi???

SQL lo ee function kosam DATEPART anedi undi kada... use that.. google chey DATEPART ani... DAY MONTH YEAR HOUR MINUTES SECONDS anni vastai... use that..

Thanks
[/quote]
[quote name='dravia' timestamp='1362076395' post='1303345280']

adi just an alternative ki cheppa :police:[size=4] ..[/size]
[/quote]
[quote name='m8espartan' timestamp='1362077155' post='1303345324']
EXTRACT(HOUR FROM timestamp) ...i guess your question is resolved...
[/quote]
[quote name='calmandquiet' timestamp='1362077491' post='1303345342']
))(<[size=4] ))(<[/size]
[/quote]
[quote name='goli soda' timestamp='1362077879' post='1303345394']
this will not work..... substring is just used to give part of that string.... ikkada date part function vadali.....
[/quote]
[quote name='DARLING...' timestamp='1362156150' post='1303349888']
Alelooya, same qochen goli
[/quote]


sorry yaa....Issue resolve indi...it's my bad...no need to use extract..
select month (DT_SVC_STARTD),
day (DT_SVC_STARTD),
Hour (DT_SVC_STARTD),
count(DT_SVC_STARTD)
FROM XXXX where extract(year from DT_SVC_STARTD) > 2011
group by month (DT_SVC_STARTD),day (DT_SVC_STARTD),Hour (DT_SVC_STARTD)
extract(Hour from DT_SVC_STARTD)
order by month (DT_SVC_STARTD),day (DT_SVC_STARTD),Hour (DT_SVC_STARTD);

Posted

Just my role is perf testing mama..ma manager DBA work nundi..testing varkaku..edi paditey adi istunadu..monna java vacha ? Oka java home tool undi, danni anni project ki implement cheyali annadi..But whatever time istunnadu.. take help from who ever you want anaadu....last month ok apost vesa kada how to import data ani..e work dani extension..mothaniki task complete indi..

[color=#008000][size=5]Big Thanks for your help..[/size][/color]

Posted

[quote name='dravia' timestamp='1362076893' post='1303345310']
Nadi ETL bro work,so koddiga week anmata SQL lo {@#[size=4] ..[/size]
[/quote]

u should be strong in SQL to do ETL.. so just learn man thats it..

Posted

[quote name='ALFANI' timestamp='1362160035' post='1303350547']
sorry yaa....Issue resolve indi...it's my bad...no need to use extract..
select month (DT_SVC_STARTD),
day (DT_SVC_STARTD),
Hour (DT_SVC_STARTD),
count(DT_SVC_STARTD)
FROM XXXX where extract(year from DT_SVC_STARTD) > 2011
group by month (DT_SVC_STARTD),day (DT_SVC_STARTD),Hour (DT_SVC_STARTD)
extract(Hour from DT_SVC_STARTD)
order by month (DT_SVC_STARTD),day (DT_SVC_STARTD),Hour (DT_SVC_STARTD);
[/quote]akada extract hour lo error endhuku vachindhi baa....error ela resolve ayindho maku cheppaledhu enka...

×
×
  • Create New...