| Author |
Topic |
|
Biz1705
Starting Member
8 Posts |
Posted - 2010-10-05 : 02:58:34
|
| Hi,Currently in database I have nvarchar (100) which is 05/10/10 7:18:46 PM . I'm trying to convert nvarchar (100) back to date. Is there stored procedure to convert it?Biz |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-10-05 : 04:06:54
|
| You can use convert function. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-05 : 04:33:27
|
quote: Originally posted by pk_bohra You can use convert function.
Can you please show the convert-statement for this '05/10/10 7:18:46 PM'? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-10-05 : 04:52:23
|
quote: Originally posted by webfred
quote: Originally posted by pk_bohra You can use convert function.
Can you please show the convert-statement for this '05/10/10 7:18:46 PM'? No, you're never too old to Yak'n'Roll if you're too young to die.
Declare @Test nvarchar(100)Set @Test = '05/10/10 7:18:46 PM'Select convert(datetime,@Test,0) |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-05 : 05:11:56
|
cool! No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-10-05 : 06:04:17
|
quote: Originally posted by pk_bohra
quote: Originally posted by webfred
quote: Originally posted by pk_bohra You can use convert function.
Can you please show the convert-statement for this '05/10/10 7:18:46 PM'? No, you're never too old to Yak'n'Roll if you're too young to die.
Declare @Test nvarchar(100)Set @Test = '05/10/10 7:18:46 PM'Select convert(datetime,@Test,0)
Beware that this depends on the local settingshttp://beyondrelational.com/blogs/madhivanan/archive/2010/06/03/understanding-datetime-column-part-ii.aspxMadhivananFailing to plan is Planning to fail |
 |
|
|
Biz1705
Starting Member
8 Posts |
Posted - 2010-10-05 : 18:05:38
|
| Thank you for your reply madhivan.I used Dbcc useroptionsgot language us_englishdateformat mdyI am based in UK date system.How can I convert nvarcha (100)to dd/mm/yyyy?Biz |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
|
|
derrickbell23
Starting Member
1 Post |
Posted - 2010-10-14 : 13:02:01
|
| I have a a similar problem could anyone help me out.I'm trying to convert a nvarchar(100) to a datetime data type.The format currently is 05-16-2010 from what I have read looks like I would like to change it to a datetime style 5. I was trying to work with the above code, where do I set my column I would like converted?Thanks for the help. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-14 : 13:10:08
|
declare @test nvarchar(100)set @test='05-16-2010'select@test as Orig,convert(datetime,@test,110) as Converted No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|