Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

SQL select help - filtering

$
0
0
Hi guys,I am quite new to the SQL, so if somebody is interested to help, I will be really glad. I need prepare some daily statistics from the database about running jobs. It is just some filtering / limitation conditions (I hope)all records I need to filter are just from one table named [b]ho.async_task[/b]there are many columns in it, however I need just following to be displayed:name I need / name of the column in db from ho.async_taskJob ID = [b]ID[/b] (example: 1050711323)Job Name = [b]SCHEDULER_TEMPLATE_CODE[/b] (example: JOB_NAMEDA)Start Time = [b]START_DATE[/b] (example: 19.09.2014 3:00:00)End Time = [b]END_DATE[/b] (example: 19.09.2014 3:00:12) Run time = should be difference between START_DATE and END_DATE in seconds. (example: 12)Status = [b]STATUS[/b] (example: F)Error message = [b]ERROR_MESSAGE[/b] (example: Error description)-- Run Time field is not in db, should be difference between start / end date in seconds-- I need track only these SCHEDULER_TEMPLATE_CODEJOB_NAMEDA,JOB_NAMEDANOTHER, JOB_NAMELESS, JOB_ANOTHER_EXAMPLE-- because some jobs (Scheduler_template_code) could have more records daily, in such an example I need display just last record-- whole SQL select should be somehow easy filterable by particular day (or possibility to display records X day back when changing some parm inside the script)--whole script could be ordered by start_date descendetso the output should be like this for given dayJob ID--Job Name--Start Time--End Time--RUN time--Status--Error description111--JOB_NAMEDA---3:00:00--3:00:12------12--------F-------blank213--JOB_NAMEDANOTHER--3:01:00--3:02:00--60-----E-----something898--JOB_NAMELESS-- etc...875--JOB_ANOTHER_EXAMPLE--etc...thanks for any help

Viewing all articles
Browse latest Browse all 3145

Trending Articles