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.
| Author |
Topic |
|
kaledev
Starting Member
4 Posts |
Posted - 2011-02-17 : 08:50:35
|
| Not sure where to post this...But hopefully this will be an easy question. I am a complete newbie to SQL Server, and I have a field called [Report Tm] set as varchar(11). It holds time in 00:00:00 AM/PM form. It isn't set as Time datatype for a few reasons, mostly because I use an Access front-end to import my data and it has all sorts of problems casting from my datetime short time to time, or even text to time, so I made it a varchar to avoid the problem.Anyway, after import I lose my AM or PM. In other words it displays 00:00:00, and thats it. Which is a bit strange because the AM or PM is definitely present in the source data...Would there be a reason for this? Using '08 Express by the way. |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-02-17 : 08:54:57
|
| Make it a varchar(13) and see if that works.JimEveryday I learn something that somebody else already knew |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2011-02-17 : 08:55:17
|
You caused more problems than you avoided. Just pass in a datetime field, and ignore the date portion.http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-17 : 10:12:19
|
without having a sample of the data and code our suggestions would only be upon guesses so come up with an example along with your existing SQL codeBy the way SQL stores the time portion in 24 hour format. therefore while pulling the time portion from the source, convert it to Time Format in your SQL code. This will convert it to 24 hour format... which hopefully would be meaningful for you Cheers!MIK |
 |
|
|
kaledev
Starting Member
4 Posts |
Posted - 2011-02-17 : 10:49:14
|
quote: Originally posted by DonAtWork You caused more problems than you avoided. Just pass in a datetime field, and ignore the date portion.
I suppose I didn't do that because I thought the random date would be confusing to other people looking at the data..For some reason it just bothers me lol, the same way the 00:00:00.000 at the end of my date field makes me shudder. I must have OCD. Although it does work if I do it this way.I guess I will stick with doing it since it seems to be the easiest and has the least overhead. |
 |
|
|
|
|
|