Monday, March 19, 2012
Date Handling in SQL Server
There are actually two webservers which connect to the SQL database in
London.
i have two questions
1. How can I insert null values when inserting dates within my records. If
gives me a type mismatch error.
2. How will the sql server differentiate that the date coming from UK
webserver example "03/01/2005" is 3rd January 2005 and the same date coming
from US webserver "03/01/2005" is 1st March 2005. Do I need to deal with
this in the ASP code?
Thanks in advance for your help.
RegardsHi,
1. Hope you are using the insert this way: insert into dbo.tablename
(test) values (null)
2. I think you have common SQL server for storing data from US and UK.
Actually, I have one question here - where are you trying to
filter/segregate the data on presentation layer or at the database end?
In case of ASP, since you have 2 webservers, client connecting from
respective location should be able to see their dates according to
their regional settings.
Coming back to SQL Server, I don't think wherein SQL Server can handle
both US and UK date formats in the same column, maybe u have to keep a
constraint say check constraint which will check for a column say
country "US" then use US date format or "UK" then use UK date format..
Hope I got you right on your question..
Regards,
Dilip|||The specifying a date in yyyy/mm/dd format should be interpreted the same
for both US and British. For example: 2005/03/01
"JP SIngh" <none@.none.com> wrote in message
news:Oq7pfo0lFHA.3568@.tk2msftngp13.phx.gbl...
>I have a SQL Database with an ASP front end.
> There are actually two webservers which connect to the SQL database in
> London.
> i have two questions
> 1. How can I insert null values when inserting dates within my records. If
> gives me a type mismatch error.
> 2. How will the sql server differentiate that the date coming from UK
> webserver example "03/01/2005" is 3rd January 2005 and the same date
> coming
> from US webserver "03/01/2005" is 1st March 2005. Do I need to deal with
> this in the ASP code?
> Thanks in advance for your help.
> Regards
>|||"JT" <someone@.microsoft.com> wrote in message
news:OGCNx41lFHA.1416@.TK2MSFTNGP09.phx.gbl...
> The specifying a date in yyyy/mm/dd format should be interpreted the same
> for both US and British. For example: 2005/03/01
No - use a format that is understood regardless of any settings.
http://www.karaszi.com/sqlserver/info_datetime.asp
Tuesday, February 14, 2012
Date between 1/1/0001 to 31/12/9999 possible in Sql server
Try using .\SQLEXPRESS as the instance name...
cheers,
Paul June A. Domag|||Great - It Works! Thanks|||After reading this thread and another one I've tried entering the following in express manager and I still can't connect:
.\MSSQLSERVER
(local)\MSSQLSERVER
I am running SQL Server Express June CTP on a Win2K3 box. SQL Express Manager is also running on the same Win2K3 box.
I have opened all the network protocols for SQL Server Express, I've also enabled the SQL Server browser. There are no firewalls involved. This is probably the most insecure setup, yet I still cannot connect locally ![]()
Any ideas?
I followed all the instructions here:
http://download.microsoft.com/download/a/6/3/a63ec922-913e-4228-93e3-970abff3fd66/ReadmeSQLExpMgr.htm
and here
http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx
Nothing seems to work.
|||Hi,
Actually its .\SQLServer not .\MSSQLSERVER.
Have you tried it? got any versions installed before the June CTP?
cheers,
Paul June A. Domag|||Unfortunately that didn't work either.
All I have installed is June CTP on a fresh install of Win2K3 Standard.
In the SQL Server Configuration Manager under "name" it says: SQL Server (MSSQLSERVER).
This would indicate the name of the SQL server is "MSSQLSERVER" correct? I chose "default" instance during the install and that is the name it gave itself.
This is getting frustrating... I thought programming with MS stuff would be easy. I could have connected to MySQL a hundred different ways by now.
|||Just a two cents worth general comment - the MS beta's tend to have problems that the production versions don't - having used SQL Server from the time it was Sybase Server to date I can say it is great software that occassionally suffers from growing pains. PS|||Yeah, I don't expect Beta software to be 100% functional but I do expect the basic functionality to be working and straightforward. Connecting to the server shouldn't be this difficult. Especially if you consider the target market for this product.
|||Hi,
Oops, I guess I had a typo. Its .\SqlExpress, If you choose default instance...
cheers,
Paul June A. Domag|||After all that I accidently stumbled upon a solution.
The only thing that works for my installation is just plain ".\" (no quotes) and nothing else. Go figure. Hopefully this post saves someone else a lot of time.
|||Hi,
Weird... Could you report a bug in Product Feedback? So that Microsoft would be aware of this...
cheers,
Paul June A. Domag|||thanks a lot this helped!!!!!
|||Thanks!!!! I have been pulling my hair out all night trying to figure out why I couldn't connect. That did the trick. Why doesn't MS tell you about these important details.|||Paul Domag wrote:
Hi,
Try using .\SQLEXPRESS as the instance name...cheers,
Paul June A. Domag
I'm getting error like
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
I want to set it bet 1/1/0001 to 31/12/9999. how to do this?
So do u have any solution over it pls.
I think u have solution over it because I have seen same problem u had .
At last Happy New Year 2006 at this first meet ing with u
Balasaheb
|||Hi,
There are only two datatypes that could handle date and time values in sqlserver. These are DateTime and SmallDateTime. Both of these types cold not handle data between1/1/0001 to 31/12/9999. But you can store these dates as a varchar and just parse the dates to calculate them in your program...
cheers,
Paul June A. Domag