ODBC Query with current date

bayyari

New Member
Joined
Oct 10, 2009
Messages
6
I am trying to pull data into excel from another program using the ODBC query. This is the code that i have:

WHERE ("BV:CallTracker"."Create-date">={ts '2010-07-05 00:00:00'})

where the date is located is what I am trying to change. I need it to just pull the current date without me having to manually enter it in.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Because you are using SQL Server by the looks of it and assuming you are currently using MSQuery, try this as the relevant element of the WHERE clause (you need to adapt the SQL string in the SQL window in MSQuery):

Rich (BB code):
WHERE ("BV:CallTracker"."Create-date">=
CAST(CAST(GetDate() As Int) As DateTime))
 
Upvote 0
I tried replacing it and i get this error

SQL Query can't be represented graphically. Continue anyway? then it says Expected lexical element not found:)
 
Upvote 0
OK! I figured it out!

WHERE ("BV:CallTracker"."Create-date">= {ts '2010-07-05 00:00:00'})

where the RED letters are you replace that with [Date] (the word Date can be changed to anything, like Date? or Date mm/dd/yyy, or any question/phrase you need it to be, the square brackets are the important part)

then when you go to return the data you can set the parameter to a specific cell. If you keep the squiggly brackets you aren't able to set a parameter for some odd reason. So, I will be testing it tomorrow to see if the data switches with the current date formula and if it does i'll post here.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,017
Members
448,936
Latest member
almerpogi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top