By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,843 Members | 2,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,843 IT Pros & Developers. It's quick & easy.

Cast

OuTCasT
100+
P: 374
hi all

could i please find out what is wrong with this select statement ?

Expand|Select|Wrap|Line Numbers
  1. SELECT INV_CheckNum, INV_CheckAmt, INV_DiscountAmt, INV_PaidAmt, INV_VendorNumOrig, INV_VendorName, RNDOC, Days, Years,CAST(DateAdd(day,Days('1/1/'+'200'+Years)as smalldatetime) as DateStart
i get this error

Arithmetic overflow error converting expression to data type smalldatetime
Oct 31 '08 #1
Share this Question
Share on Google+
1 Reply


code green
Expert 100+
P: 1,726
It is a data type error somewhere in here
Expand|Select|Wrap|Line Numbers
  1. CAST(DateAdd(day,Days('1/1/'+'200'+Years)
  2. as smalldatetime) as DateStart 
Debug this by removing the wrapper functions and 'seeing' what is there.
Then add a function wrapper at a time and check what is there again. ie
Expand|Select|Wrap|Line Numbers
  1. day
Expand|Select|Wrap|Line Numbers
  1. Days('1/1/'+'200'+Years) 
then
Expand|Select|Wrap|Line Numbers
  1. DateAdd(day,Days('1/1/'+'200'+Years)as smalldatetime 
then
Expand|Select|Wrap|Line Numbers
  1. CAST(DateAdd(day,Days('1/1/'+'200'+Years)
  2. as smalldatetime) as DateStart 
Oct 31 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.