on 2020 Jul 02 10:54 PM
Hello Community,
I'm trying to use Free hand SQL to execute a Stored procedure and prompt for a date, but I'm getting datatype conversion error. Below is the query and error.
EXEC [Test].[dbo].[Alpha] @FridayDate = @Prompt('Enter Date','A',,Mono,Free,Persistent,,User:0)

Originally the data type for variable @FridayDate is varchar in SP, and when I change the datatype to Date, I'm getting the below error.

I'm able to pass the date value directly with no issues, below is the query.
EXEC [Test].[dbo].[Alpha] @FridayDate = '20200605'
Could anyone please suggest how to resolve this.
Thanks,
Kristen
Request clarification before answering.
Can you change the prompt to "D" or "DT" instead of "A"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your reply, Jawahar!
I have tried both "D" and "DT". I'm getting below error for "D", I think it's because "D" is passing today's date and @FridayDate can only accept Friday dates like 7/3/2020, 6/26/2020.
EXEC [Test].[dbo].[Alpha] @FridayDate = @Prompt('Enter Date','D',,Mono,Free,Persistent,,User:0)

DT is giving the same datatype conversion error as in first screenshot.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.