Msg 242, Level 16, State 3, Procedure date, Line 17 The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
this code following set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER procedure [dbo].[test] @id int='' as begin --INSERT AFTER 2 MONTHES DATE --select dateadd(m, 2, getdate()) DECLARE @curentdate as datetime set @curentdate=GETDATE() DECLARE @olddate as datetime set @olddate= (select date from calculation where id=@id) DECLARE @amount as float set @amount=(select amount from calculation where id=@id) DECLARE @days as nvarchar(10) while(@olddate<@curentdate) begin set @days=datename(dw, @olddate) if(@days = 'Monday' or @days = 'Tuesday' or @days = 'Wednesday' or @days = 'Thursday' or @days = 'friday') begin set @amount=@amount+2 end ELSE if(@days = 'Sunday' or @days = 'Monday') begin set @amount=@amount+1.5 end set @olddate=@olddate+1 end update calculation set amount=@amount,date=@curentdate where id=@id end plz solutation this.
October 1st, 2012 5:02am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics