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 |
magiips
Starting Member
2 Posts |
Posted - 2011-01-13 : 02:18:39
|
Guys.. i got struck with a concept..I have an existing table with two fields, say Table1 timesheetnumber navarchar(50) date navarchar(50)All i need to do is i need to move the data from this table to a similar table say Table2 with the date column as datetime field.So the new table will have two columns namely...timesheetnumber nvarchar(50),date datetimeInsert into Table2 (timesheetnumber,date)Select timesheetnumber,date from Table1So i need to know how to convert the nvarchar field from Table1 to date field in Table2Note that the "date" column of the Table1 has data in the format 15-Jul-2010.So we need to make clear that we are converting in from this format.. Any one help pls.. very urgent!!Mag |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-13 : 03:46:48
|
convert(datetime,'15-Jul-2010',113) i.e.convert(datetime,YourDateCol,113) No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
magiips
Starting Member
2 Posts |
Posted - 2011-01-13 : 04:14:49
|
Thanks.... That has worked out !!!!!!!!!Mag |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-13 : 04:18:16
|
welcome No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
|
|
|