web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / using Select date dial...
Power Automate
Answered

using Select date dialog variables in SQL statement

(0) ShareShare
ReportReport
Posted on by 95

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 ??

  • Verified answer
    NorsemanRoo Profile Picture
    95 on at

    changed to this and all works 😄

     

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 273 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 235

#3
David_MA Profile Picture

David_MA 172 Super User 2026 Season 2

Last 30 days Overall leaderboard