Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Arithmetic overflow error

Author  Topic 

adjones1980
Starting Member

36 Posts

Posted - 2008-01-23 : 11:23:40
Hey guys,

I am trying to run the following from ASP.Net...

INSERT INTO Metafile 
VALUES ('f002d4df-cf0e-4ea2-a2ab-b456a98875f9',
99999,
'iouhoiu',
'efgrergr',
CONVERT(nvarchar(50),'01/01/2002 00:00:00',103),
CONVERT(nvarchar(50),'01/01/2003 00:00:00',103),
'',
'',CONVERT(nvarchar(50),'01/03/2004',103),
'',
'999999',
'999999',
'999999',
'999999',
'001',
0.222,
'007',
'',
CONVERT(nvarchar(50),'23/01/2008 00:00:00',103),
'UK GEMINI Standard',
'version 1')


... and get the following error...

Server: Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type smalldatetime.
The statement has been terminated.


Not sure what I am doing wrong with the date convert. FYI I am in the UK so using UK date format.

Thanks for any help

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-01-23 : 11:41:47
Why converting at all when you apparently is going to use dynamic sql?
It is also a good practive to always use ISO standard when dealing with dates (yyyymmdd).

INSERT INTO Metafile
VALUES ('f002d4df-cf0e-4ea2-a2ab-b456a98875f9',
99999,
'iouhoiu',
'efgrergr',
'20020101',
'20030101',
'',
'',
'20040301',
'',
'999999',
'999999',
'999999',
'999999',
'001',
0.222,
'007',
'',
'20080123',
'UK GEMINI Standard',
'version 1')



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -