converting timestamp to date in where clause

Database
Enthusiast

converting timestamp to date in where clause

HI All,

I need to write a delete statement which should convert the timestamp column to date in the where clause like below.

Delete from table a where current_date = cast(a.date_timestamp as date)

where a.date_timestamp is a timestamp column in the table a

current_date is the date column when the job runs daily.

I tried to execte the above quer but it is showing an error like..invalid ansi date operation...

Please help me how can i do this...

Regards,
mora
3 REPLIES
Enthusiast

Re: converting timestamp to date in where clause

Hi,
please paste your query to get correct reply. When i run the query, its working perfectly.

delete from abc.table1 a where current_date=cast(a.today_timestamp as date);
its deleting the required records.

SN
Enthusiast

Re: converting timestamp to date in where clause

hi,

how did you define 'date_timestamp' field in your table?

Enthusiast

Re: converting timestamp to date in where clause

its timestamp(0);