Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm taking data for the last 45 days with a select function. I need to keep the data of the days before. For the first day i use the normal select. When i tried to use replace select it doesn't work. It only takes data for the day 45 (from today). What can cause this problem?
SQL:
SELECT [date]
FROM Table
WHERE [date] >= DATEADD(day, -45, CURRENT_TIMESTAMP);
Fetch all Values where date >= today - 45 days
I have a function like:
select * from function(day,other things)
I call it 45 times, choosing day as current date, current date -1,..., current date -45. The data for 46 days ago i still need it, but it is not changing anymore. The replace select is not working.
replace function is used only for string or character conversion..use convert for date conversion
like convert (char(12),getdate(),103)
just change the third parameter to change the date style..