cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NorsemanRoo
Resolver I
Resolver I

using Select date dialog variables in SQL statement

Hi 

I've been working on a flow in PAD that firstly opens a dialog with two dates in it. it then opens sql and uses these two variables in a SQL Query to create a table.  The variables seem to come out with the correct data, and if I paste the results directly into a SQL Query it works.  If I try it within the flow I get this error

 

Error in SQL statement The statement has been terminated.
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

 

The SQL statement in the flow is as follows:

 

select job,clockindate
into TBL_001
From TBL_002
WHERE        (ClockInDate > CONVERT(DATETIME, '%SelectedDate%', 102) AND ClockInDate < CONVERT(DATETIME, '%SecondSelectedDate%', 102))

 

like I say if I uses the variable results directly in sql it works 😞  any ideas ??

1 ACCEPTED SOLUTION

Accepted Solutions
NorsemanRoo
Resolver I
Resolver I

changed to this and all works 😄

 

WHERE        (ClockInDate > CONVERT(DATETIME,  '%SelectedDate%',103) AND ClockInDate < CONVERT(DATETIME, '%SecondSelectedDate%',103))

View solution in original post

1 REPLY 1
NorsemanRoo
Resolver I
Resolver I

changed to this and all works 😄

 

WHERE        (ClockInDate > CONVERT(DATETIME,  '%SelectedDate%',103) AND ClockInDate < CONVERT(DATETIME, '%SecondSelectedDate%',103))

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,348)