Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"variable" limit

Status
Not open for further replies.

mstepPCI

MIS
Jun 14, 2004
8
US
I'm VERY new to brioquery and here is what i want to do.
I need to limit my query based on a date in a database. Furthermore, i need to limit this date minus 8 days to capture all the dates on the previous Sunday. (all the dates in this field are on Mondays).

I can't hardcode the dates because they are always changing, is there anyway to automate this?

The data is set up YYYYMMDD.
 
Have you try using the Custom SQL as your variable limits? You can set the SQL statement to something like:
to_char(sysdate)-8

So when you schedule it to run on any given day it will only extract the data from 8 days ago.

Hope that helps.
 
I already tried doing this (a different way allbeit). What you said gives a syntax error. Do i really want to convert to characters when doing a calculation?
 
What type of database are you using? the SQL syntax between Oracle and MS SQL are slightly different.
 
mstepPCI,
I'm not familiar with Redbrick. However, this SQL scripts: (datepart(wk, dateadd(dd,-1, TABLE_NAME.COLUMN_NAME)) = datepart(wk,dateadd(dd,-1, getdate())) - 1)

Hope this helps.
 
error(449) Function dateadd has incorrect type for argument 3. Expected type: DATETIME, actual type: CHARACTER
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top