473,473 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Question: Date field

B
Using SQL2000, to give a little history. Original data stored on DB2, and
transferred on MySQL into one table with 50 fields and more than 500,00+
records. This then gets transferred to sqlserver via DTS, also in the same
structure as MySQL.

The exception of one field, where shipping_date was assigned as "decimal"
data type on DB2 and MySQL.
On sqlserver, I changed the datatype to "datetime", it gets converted
through DTS.

The reason why I made the change is because it is quicker to retrieve the
data and for assigning indexes. Am I wrong with this justification? Now
upper mgnt is questioning me about it.

What would be the disadvantage if I were to leave "shipping_date" as
decimal? data looks like yyyymmdd (20040201), my concern since the table is
not normalized and and it takes forever to drop and re-create the indexes,
that I have totally abandoned the indexes.

Please advise, TIA!
Bob
Jul 23 '05 #1
3 1326
Hi

It sounds like you have missed the opportunity to use a normalise the
structure when you transfer it into SQL Server!

If you are not displaying the shipping date or display it as is, then you
are probably better leaving it as it is, or converting to integer. An
integer will be 4 bytes, decimal(8,0) will be 5 bytes and datetime 2*4
bytes. Whatever you do, indexes will almost certainly significantly improve
the performance.

John

"B" <no_spam@no_spam.com> wrote in message
news:s8********************@rcn.net...
Using SQL2000, to give a little history. Original data stored on DB2, and
transferred on MySQL into one table with 50 fields and more than 500,00+
records. This then gets transferred to sqlserver via DTS, also in the same
structure as MySQL.

The exception of one field, where shipping_date was assigned as "decimal"
data type on DB2 and MySQL.
On sqlserver, I changed the datatype to "datetime", it gets converted
through DTS.

The reason why I made the change is because it is quicker to retrieve the
data and for assigning indexes. Am I wrong with this justification? Now
upper mgnt is questioning me about it.

What would be the disadvantage if I were to leave "shipping_date" as
decimal? data looks like yyyymmdd (20040201), my concern since the table
is
not normalized and and it takes forever to drop and re-create the indexes,
that I have totally abandoned the indexes.

Please advise, TIA!
Bob

Jul 23 '05 #2
On Sun, 6 Feb 2005 10:11:12 -0500, B wrote:

(snip)
The exception of one field, where shipping_date was assigned as "decimal"
data type on DB2 and MySQL.
On sqlserver, I changed the datatype to "datetime", it gets converted
through DTS.

(snip)

Hi Bob,

Seems like an excellent choice to me. If you want to store dates, use a
datetime datatype - any other choice is silly and begging for trouble.

Do you realize how complicated your CHECK constraint needs to get to make
sure that only valid dates are entered if you store the date as numeric?

Do you realize how hard is is to calculate the number of days from Dec 28
2004 to March 17 2005 if you store the date as numeric?

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Jul 23 '05 #3
B (no_spam@no_spam.com) writes:
The exception of one field, where shipping_date was assigned as "decimal"
data type on DB2 and MySQL.
On sqlserver, I changed the datatype to "datetime", it gets converted
through DTS.
Converted to what? I don't know DTS, but I doubt that it would convert
the number 20040201 to the date 2004-02-01 automatically. I would expect
the result to be 20040201 days from 1900-01-01, which is out of range for
datetime.

Since you know more DTS than I do, maybe your were smart enough to write
some transformation thing to get it right. But I wanted to point this
out in case.
The reason why I made the change is because it is quicker to retrieve the
data and for assigning indexes. Am I wrong with this justification? Now
upper mgnt is questioning me about it.
Well, if some program that was reading the database broke because of
your change, maybe you were wrong.

Generally, though, I would recommend using datetime for dates, even if,
as John says, the datetime value is actually twice the sice of an int.
But, as Hugo says, computation and validation of the numeric values is
a mess.
data looks like yyyymmdd (20040201), my concern since the table is
not normalized and and it takes forever to drop and re-create the indexes,
that I have totally abandoned the indexes.


If you drop the indexes, then the queries against the tables will
take even longer time. But you may have indexes that does not really
serve any purposes.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #4

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

Similar topics

1
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on...
3
by: JC Mugs | last post by:
Help needed for project-Access 2002(office xp) PROBLEM: Figuring out how to lookup a record and DDate field in Table1 - Take that DDate-field data from record looked up and assign it to Date...
9
by: noone | last post by:
I have a database file that I use an autonumber field as the primary key index. Because of some rearrangements in the past, this index does not match the order that I would like it to be in, that...
5
by: John | last post by:
Hi, I have an asp.net form where if the user enters an incorect date I change the color of the textbox to red and also display a label field with a message saying the date is invalid. What I...
5
by: troy_lee | last post by:
I have a table that has a PK field with the following format: Dyymm123. So that, a typical number might look like this D0806270. The first character is literal and never changes. The next four...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.