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 |
rjrferreira
Starting Member
13 Posts |
Posted - 2007-08-09 : 11:11:27
|
Ii made an sql statmente with cursor that gets some info. this info contains a date in this format "dd/mm/yyyy" because is a varchar field.Now i want to copy that info to another field but this field in database are in this format "mm/dd/yyyy".... so my problem is how to change the first format do the second and update the new info.i tried yet with convert, but not worksgreetings |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-08-09 : 12:06:38
|
Why are you using varchar to store dates ????Never store dates in any particular format using string formats. Always simply use the DateTime data type. This the most important and most basic rule of database design. Always, always, always use correct data types in your database designs.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-10 : 01:38:32
|
1 As said, dont use varchar to store dates. Use DATETIME datatype2 Create another column with proper DATETIME datatype and update that column byUpdate tableset datetime_column=dbo.proper_date(replace(varchar_column,'/',''))(Use the function from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=82164)[/code]3 Let the front end application do the formationMadhivananFailing to plan is Planning to fail |
|
|
|
|
|