on 09-02-2014 5:54 PM
Hello
I am trying to create a SP which restricts the 'Valid to' date of Quotes which contain a specific Item: (OQUT.DocDueDate)
--No valid to date later than 30 september for WGR -1-BSPP
If @object_type = '23' and @transaction_type IN ('A','U')
BEGIN
If Exists (Select T0.DocEntry from [dbo].[OQUT] T0 Inner Join QUT1 T1 On T0.DocEntry=T1.DocEntry
Where T0.DocEntry = @list_of_cols_val_tab_del and T1.ItemCode = 'WGR-1-BSPP' AND T0.DocDueDate > '30.09.2014')
BEGIN
Select @error = -1,
@error_message = 'Adjust valid to date, must be before 30th September'
End
End
The query is executing ok without error but I get following error when trying to add a quote with the part:
"The conversion of a varchar data type to a datetime data type resulted in an out-of-range value (CINF.)"
I can see that my understanding of the dating part is wrong - can anyone assist?
Thanks
Karen
Try this:
--No valid to date later than 30 september for WGR -1-BSPP
If @object_type = '23' and @transaction_type IN ('A','U')
BEGIN
If Exists (Select T0.DocEntry from [dbo].[OQUT] T0 Inner Join QUT1 T1 On T0.DocEntry=T1.DocEntry
Where T0.DocEntry = @list_of_cols_val_tab_del and T1.ItemCode = 'WGR-1-BSPP' AND T0.DocDueDate > convert(datetime,'20140930',103))
BEGIN
Select @error = -1,
@error_message = 'Adjust valid to date, must be before 30th September'
End
End
Regards,
JC.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.