Jump to content

Create Date Range Parameters in Excel SQL


rhysdunn

Recommended Posts

I have written a SQL Query for my Database at work in Excel so that I can automatically update it. Took me a while to figure out the date sections and getting it to return just the current date with the below code.

 

 

WHERE
f.FolioStatusId in (1, 7, 8, 9, 13)
AND cast(f.made_on as date) >= cast(getdate() as date)
What I'd like to do is to have a section in Excel where I can type the Dates that I need the data from and too.
I know that I can insert a "?" in the query section to make a cell reference but cant figure out what code would need to go in the WHERE section to do that.
Any help would be greatly appreciated!
Link to comment
Share on other sites

I've formatted as a date but the error i get is as below

 

[Microsoft][ODBC SQL SQL Server Driver]

 Conversion failed when converting date and/or time from character string

 

I've formatted though which is the strange thing

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...