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 |
|
olily
Starting Member
37 Posts |
Posted - 2002-07-24 : 01:26:16
|
| I wrote a few sql statements to format the time to military format but the statements are too long and redundant. Is there any simpler way to do this task? Datatype is varchar(10) and sample data:430pm5:15pm8:45am6:00am500am09:10am0430am0300pm1230pm100AM1200AM145PM9:10PM08:00PM |
|
|
joldham
Wiseass Yak Posting Master
300 Posts |
Posted - 2002-07-24 : 07:51:37
|
If you run the following Update statement, it will make the information in the table easier to parse through. Update Military_DateSet Brief_Date = replace(Brief_Date, ':', '')Where charindex(':', Brief_Date) > 0Update Military_DateSet Brief_Date = '0' + Brief_DateWhere Len(Brief_Date) = 5If you can, I would put constraints on your table to make sure that the information being put into this column is in the correct format (i.e. no ':', datatype of char(6), etc.)Jeremy Edited by - joldham on 07/24/2002 08:08:02Edited by - joldham on 07/24/2002 08:08:36 |
 |
|
|
|
|
|