Support Portal

for ProcessRobot and WinAutomation

Start a new topic

execute sql in excel


I'm trying to run execute sql in excel using dateadd and datediff but

having error "No value given for one or more required parameters."

here is the sample query im running. thanks

SELECT datediff(month, "2/2/2019", "3/1/2018") from table

can you please help with the correct syntax? thanks

I used "select FORMAT([Field], 'dd-MM-yyyy')" hope this helps.

Have you managed to make it work? I'm also interested in the DATEDIFF function.

Also, I can't update SQL withe the %CurrentDate% parameter...and also it doesn't work to compare a [Field] with the %CurrentDate%

What I did was use addtodatetime first then use that variable in sql query.


select a from [table$] where [salesdate]  <  #%adddate%#

The below is the syntax for DateDiff in sql for ms access which is the driver used for sql against excel. Example Let's look at how to use the DateDiff function in MS Access: DateDiff ("yyyy", #15/10/1998#, #22/11/2003#) Result: 5 DateDiff ("m", #15/10/2003#, #22/11/2003#) Result: 1 DateDiff ("d", #15/10/2003#, #22/11/2003#) Result: 38

Those who do not know how to execute the SQL in the excel can know from here and it will be very useful for those who are in the database filed.

iTunes error 9

Login or Signup to post a comment