So, I'm using DateAdd. It is storing data in an internal table via Select .... Into #table From table. In the internal table I am calculating date1 field with DateAdd.
I am then appending results of #table to another table #result (which was created using Create Table). In the create table I have two fields date1 and date2 which are both declared as "smalldatetime" fields.
I am receiving an error "Adding a value to a 'datetime' column caused an overflow. The statement has been terminated".
Seems that the issue is that the DateAdd returns a DATETIME so when I put the values in my date1 field I receive the overflow error.
How do I cast my formula so it returns as a SMALLDATETIME?
DATEADD(day,1,startDT) as date1,