473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Dates in SQL Server

I have a SQL Database with an ASP front end.

There are actually two webservers which connect to the SQL database in UK.

i have two questions

1. How can I insert null values when inserting dates within my records. If
gives me a type mismatch error is the form field was empty.

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? or maybe I need to convert them to a more generic
format. Does anyone know of a fool proof function to convert the dates into
universal formats.

Thanks in advance for your help.

Regards
Aug 2 '05 #1
3 1589
JP SIngh wrote:
I have a SQL Database with an ASP front end.

There are actually two webservers which connect to the SQL database
in UK.

i have two questions

1. How can I insert null values when inserting dates within my
records. If gives me a type mismatch error is the form field was
empty.
Pass Null if the form field is empty

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? or maybe I need to convert them to a
more generic format. Does anyone know of a fool proof function to
convert the dates into universal formats.


http://www.aspfaq.com/show.asp?id=2040 help with dates
http://www.aspfaq.com/show.asp?id=2260 dd/mm/yyy confusion
http://www.aspfaq.com/show.asp?id=2313 vbscript
HTH,
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Aug 2 '05 #2
> 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.


Don't use silly and ambiguous date formats. Pass YYYYMMDD. The database
won't get confused, nor will any of your users.

http://www.aspfaq.com/2023
Aug 2 '05 #3
SP
SQL Server will store dates in its format, as long as it's a valid date
format, SQL Server should recognize it when doing updates or inserts.
For example
"Update myTable set myDatetime = " & cdate(strDateEntered) & "where id = " &
Idnumber

The presentation is, just that... formatting data on display.
when you pull your date from the database you should just format it in the
way you want to view it.
for example
"Select convert(varchar(10),myDatetime,1) as MyDate FROM MyTable where Id =
" & IdNumber

in this case you will see the MyDate displayed as "MM/DD/YY" of course there
are other format options so have fun playing with them.

Cheers,

SP
"JP SIngh" <no**@none.com> wrote in message
news:uj**************@TK2MSFTNGP15.phx.gbl...
I have a SQL Database with an ASP front end.

There are actually two webservers which connect to the SQL database in UK.

i have two questions

1. How can I insert null values when inserting dates within my records. If
gives me a type mismatch error is the form field was empty.

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? or maybe I need to convert them to a more generic
format. Does anyone know of a fool proof function to convert the dates
into
universal formats.

Thanks in advance for your help.

Regards

Aug 4 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mohamad Fazli | last post by:
Hi.. I am currently working on a project which require me to set a VM-wide dates according to the dates of the server. The server has been changing times so fast (since it's a billing...
4
by: F | last post by:
Hi I have posted the question few days back about problem in inserting the dates in SQL server and thankful to them who replied. That was solved and this is a nice solution....
5
by: PW | last post by:
<rant> Sorry guys, but I just have to whinge. Dates in ASP are a total pain in the butt! I seem to get caught out so many times. I realise its my own fault, but going from the posts in this...
5
by: Paul Mason | last post by:
Hi folks, We have two servers running ASP.NET systems. One is live and one is development. I have recently adopted an ASP system from a colleague to nurse it back to health. On the...
24
by: PromisedOyster | last post by:
Is there a way that I can get a resultset that contains unique dates in a given date range without the need to have a temporary table and a cursor? perhaps something like: declare @start_date...
1
by: Lars Netzel | last post by:
On Server1 when running my ASP:NET application and selecting records from an SQL server the Dates show up in Swedish Format (yyyy-mm-dd) this is good this is what I want. Right now we are...
3
by: rugger81 | last post by:
I am currently working in the sql server 2000 environment and I want to write a function to pull all dates within a given date range. I have created several diferent ways to do this but I am...
5
by: AAJ | last post by:
Hi Does anyone know of any good publically available set of standards for managing dates when dealing with a database server (in my case SQL Server 2000 and c# VS2005). At the moment, if I...
1
by: santiago | last post by:
Hello. I'm having troubles with a query that (should) return all the records between two dates. The date field is a datetime type. The db is SQL Server 2000. When I try this SELECT ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.