need to test a query using three diff dates

Database
Enthusiast

need to test a query using three diff dates

Hi,



i want to test my query on three different dates .Either it takes the dates during run time or pick three defined dates.



I am not sure if recursive will help in here as I have not used it before.





Can someone help me on this?





Thanks

7 REPLIES
Junior Contributor

Re: need to test a query using three diff dates

It's hard to help without knowing what you try to do. 

You need to add more details including some sample data and expected result...

Teradata Employee

Re: need to test a query using three diff dates

SELECT CURRENT_DATE, CURRENT_DATE - 1, CURRENT_DATE - 2

Enthusiast

Re: need to test a query using three diff dates

I want to run the following query with three random dates since last 6 months

SEL File_Id

FROM  databaseschema.tablebame

where cast (Accnt_Start_Dttmz as date) = '2016-01-21 '

now i want the dates to change everytime i run this query..like parameterised it somehow

Junior Contributor

Re: need to test a query using three diff dates

You can use CURRENT_DATE - RANDOM(0, 182) to get a random date

Enthusiast

Re: need to test a query using three diff dates

can you explain a bit more

plus what if I want to choose dates myself at the time of running.

Junior Contributor

Re: need to test a query using three diff dates

You simply use this in WHERE.

But if you choose a date it's not random :)

You must explain more...

Enthusiast

Re: need to test a query using three diff dates

If its a simple query, put it in a macro and parameterize the input date.