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.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Column doesn't upload correctly

Author  Topic 

jberthiaume
Starting Member

5 Posts

Posted - 2012-08-01 : 15:30:32
Hi, I am trying to figure why the "Age" category of my database doesn't upload correctly for all the players in the database. Here is what it presently looks like: http://www.themshl.com/player_list.php

Each player in the .csv file has its date of birth and the age should be calculated automatically for every player on the website, after the upload, but it doesn't work.

There are a total of 1468 players and exactly 889 players don't have their age.

Any help would be appreciated.
Thank you

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-08-01 : 15:47:41
You have to find the difference between the birthdates that work and that dates which don't work.
We can't see anything from here...



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2012-08-02 : 03:53:11
Are the dates in the .csv-file of correct format and valid dates? Post a sample from the csv with some of the players that don't have their age calculated correctly.

- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page

jberthiaume
Starting Member

5 Posts

Posted - 2012-08-02 : 04:43:33
Here is the title bar:

Number Name Team Country AgeDate

Player that works:
81 Aaron Palushaj 0 USA 9/7/1989

Player the don't work:
78 Aaron Gagnon 0 CAN 4/24/1986

Exactly the same thing if you ask me...
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2012-08-02 : 05:52:57
It's probably a date format issue and the order of day and month. I would guess that your database reads the date in DD/MM/YYYY format while the date is actually MM/DD/YYYY.

- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2012-08-02 : 05:54:58
What is the data type of this column in your database? You should use datetime and the display the age as DATEDIFF(year, date_column, getdate())

- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page

jberthiaume
Starting Member

5 Posts

Posted - 2012-08-02 : 06:47:38
In the database, its a type: double.
The date format issue seems completely right!

Where am I supposed to modify the date entry format to (year, date_column, getdate()) ?
Go to Top of Page

jberthiaume
Starting Member

5 Posts

Posted - 2012-08-02 : 06:51:28
No sorry, the agedate column is a varchar(10)
The age column is a double.
Go to Top of Page

jberthiaume
Starting Member

5 Posts

Posted - 2012-08-02 : 07:17:18
Got it !!!!

Thank you very much !!!!
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2012-08-02 : 07:42:03
Excellent :)

- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page
   

- Advertisement -