Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi all, Please help.I have created a new SQL dB and imported a table from Access to SQL.my date columns in Access have been imported as nvarchar(50).all dates are in the format dd/mm/yyyy.And there is no bad dataMy problem is that in the table design of my new SQL Table, if I change the datatype from nvarchar(50) to datetime I get the error "Arithmetic overflow error converting expression to data type datetime"I know this is telling me that there is a problem with the format of some of the dates but all my dates are defo dd/mm/yyyy ,none of the data has format mm/dd/yyyy ie a 13th month.I know this because I cut the data down to just 2 pieces of data.can someone help me get the format into datetime pleaseRay..
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts
Posted - 2008-02-29 : 08:05:34
Did you check your datetime data by using ISDATE() function?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
quote:Originally posted by harsh_athalye Did you check your datetime data by using ISDATE() function?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
--Lumbago"SELECT Rum, Coke, Lime, Ice FROM bar WHERE ClosingTime = 'Late' AND FemaleMaleRatio > 4"
rwaldron
Posting Yak Master
131 Posts
Posted - 2008-02-29 : 11:33:13
Hi all and thx for replyselect isdate('20/11/2004') returns 0select isdate('11/20/2004') returns 1So SQL thinks 20/11/2004 is NOT a date.SQL must be defaulting to mm/dd/yyyyBut I want dd/mm/yyyyWhat do I need to do?
rwaldron
Posting Yak Master
131 Posts
Posted - 2008-02-29 : 12:40:24
Hi all,My sql server properties - language says English(United States)I assume if i change this it will sort my problem but this will effect my other dB's ?please helpRay
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2008-03-03 : 01:48:22
set dateformat dmycheck validationsset dateformat mdyMadhivananFailing to plan is Planning to fail
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts
Posted - 2008-03-03 : 19:21:21
FYI - SQL will always accept dates of the format YYYYMMDD.=======================================Society is like a stew. If you don't keep it stirred up you get a lot of scum on the top. -Edward Abbey, naturalist and author (1927-1989)