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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing today's date in a pass-through query

Status
Not open for further replies.

junkmail

Programmer
Jan 7, 2001
134
US
I am using a pass-through query that calls a stored procedure in sql 2005 but it requires a date paramater. If I hard code the date in the pass-through query everything works like it should. Is it possible to pass "todays" date so every time the query runs it is using the current date if so how do I accomplish it?
 
hi,

for instance...
Code:
where [Your Date Field] Between Date() and Date() + 7


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
this works:

exec dbo.sp_llbacklog '06/26/12'

this does not:

exec dbo.sp_llbacklog date()

The stored procedure in SQL uses the date to do the selection.
 


It wants TEXT, not a DATE -- BIG DIFFERENCE!!!
Code:
exec dbo.sp_llbacklog [b]Format(date(),'mm/dd/yyyy')[/b]
Might take QUOTES rather than APOSTROPHIES in the Format() function.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Do you have any other suggestions as I still get the same error. thanks.
 
oops.

Did you CHANGE the structure to return only 2 characters of year?
Code:
exec dbo.sp_llbacklog Format(date(),'mm/dd/[b]yy[/b]')




Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
If the p-t is to SQL Server, you need to use GetDate() rather than date. Keep in mind this will include the current time also. You can search the web on how to convert the date/time to date only.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top