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 Programming
 Type change - Datetime

Author  Topic 

shiyam198
Yak Posting Veteran

94 Posts

Posted - 2010-07-12 : 15:57:15
Hi,

I have a table that has a column Event_date with type "datetime"
Sample data would be - "2010-03-10 19:00:00.000"

When I right click the table, select design, change the type to NVARCHAR(50), it is changing to "Mar 10 2010 7:00PM"

Is there any way, i can change the type to NVARCHAR and still keep the text as it is. i.e. - "2010-03-10 19:00:00.000"

Thanks for your time.

Regards,
Shiyam

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2010-07-12 : 16:06:18
If column Event_date is used to store datetime values, it is best to leave it as a datetime.

The problem you had is just one of many possible reasons why storing a datetime as a character string is a bad idea.






CODO ERGO SUM
Go to Top of Page

shiyam198
Yak Posting Veteran

94 Posts

Posted - 2010-07-12 : 16:12:29
Thanks Mike. I will try to manage this while keeping this data in date-time format.

I will post back if i hit a block
Go to Top of Page
   

- Advertisement -