Home Analyst Portal
Options

Is it possible to use GETDATE in SQL Queries with the Dashboard API

Jan_SchulzJan_Schulz Customer Adept IT Monkey ✭✭

Hi,

we need to filter our Query with a DateTime Timestamp from the actual date. We want to get alle Workitems which are last changed in the last 1 day.

Our Code

SELECT DisplayName, LastModified

 FROM [CiresonServiceManagement].[dbo].[WorkItem]

 where LastModified >=  (DATEADD(day, -1, GETDATE())


in Sql we get the right results but in the SQL Dashboard Widget we dont get any result. Dont know why. Can somebody give us a hint on that?

regards,

Jan

Best Answer

  • Options
    Peter_MuttenthalerPeter_Muttenthaler Partner Advanced IT Monkey ✭✭✭
    edited February 2022 Answer ✓

    Hi @Jan_Schulz

    for me its working but you've forgotten a bracket:

    SELECT DisplayName, LastModified

     FROM [dbo].[WorkItem]

     where LastModified >= (DATEADD(day, -1, GETDATE()))

    take care which database you've selected in Cireson ;)

Answers

  • Options
    Peter_MuttenthalerPeter_Muttenthaler Partner Advanced IT Monkey ✭✭✭
    edited February 2022 Answer ✓

    Hi @Jan_Schulz

    for me its working but you've forgotten a bracket:

    SELECT DisplayName, LastModified

     FROM [dbo].[WorkItem]

     where LastModified >= (DATEADD(day, -1, GETDATE()))

    take care which database you've selected in Cireson ;)

  • Options
    Jan_SchulzJan_Schulz Customer Adept IT Monkey ✭✭

    @Peter_Muttenthaler thank you. the small mistakes :-D

Sign In or Register to comment.