|
-
Mar 24th, 2005, 04:50 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] SQL Date Issue
Im having an issue when inserting a date into my sql server table.
the table's date column is set to smalldatetime
so when i try to insert the date 23/03/2005 into the column, when i look on sql server the field contains 01/01/1900
however if i insert 03/23/2005, when i look on sql server the field contains 23/03/2005
why is this happening..... my regional settings are set to GMT.
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Mar 24th, 2005, 10:11 AM
#2
Fanatic Member
Re: SQL Date Issue
There's nothing wrong, thats just the way SQL stores dates.
If wishes were fishes we'd all cast nets.
-
Mar 24th, 2005, 10:14 AM
#3
Thread Starter
Fanatic Member
Re: SQL Date Issue
but why is it requiring me to insert the date in american format.
why cant i insert as the european format
when i insert as european date it gives me an error as it recognises that the 23 is not a month
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Mar 24th, 2005, 10:15 AM
#4
Re: SQL Date Issue
 Originally Posted by Strider
but why is it requiring me to insert the date in american format.
why cant i insert as the european format
when i insert as european date it gives me an error as it recognises that the 23 is not a month
SQL Server is very date biased to the American format.
We always use YYYY-MM-DD when doing date INSERT's - so that ambiguity does not become a problem.
-
Mar 24th, 2005, 10:18 AM
#5
Thread Starter
Fanatic Member
Re: SQL Date Issue
to make things all the more strange.......
my application was working fine for the past two weeks then suddenly in the past few days its wont allow me to insert a date.now() into the date field....
i get the error i previously mentioned....
however, however...... when u insert date.today() it sets the date in the field to the 01/01/1900 ...and that aint the right date....
what the hell is going on.
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Mar 24th, 2005, 10:21 AM
#6
Re: SQL Date Issue
 Originally Posted by Strider
to make things all the more strange.......
my application was working fine for the past two weeks then suddenly in the past few days its wont allow me to insert a date.now() into the date field....
i get the error i previously mentioned....
however, however...... when u insert date.today() it sets the date in the field to the 01/01/1900 ...and that aint the right date....
what the hell is going on.
01/01/1900 is a "blank" date getting inserted into the date field.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|