cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using Free Hand SQL With Date Prompt (4.2 SP5)

kbenson
Explorer
1,371

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Can you change the prompt to "D" or "DT" instead of "A"?

kbenson
Explorer
0 Kudos

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.