| Author |
Topic |
|
boltosaurus
Starting Member
7 Posts |
Posted - 2011-11-28 : 07:41:16
|
| Hi guysI have such problem:I have a column of type nvarchar with values like 'Nov 27 2011' which as you understand represents date :).Is there any way to parse these values to datetime format?Thanks for the assistance! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 07:43:08
|
| if the regional settings of your server is english you can useselect cast(yourdatefield as datetime)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
boltosaurus
Starting Member
7 Posts |
Posted - 2011-11-28 : 07:54:27
|
| thanx for the replyI got an exception:"Conversion failed when converting datetime from character string." |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 08:06:05
|
quote: Originally posted by boltosaurus thanx for the replyI got an exception:"Conversion failed when converting datetime from character string."
then that means you've some other format date values also in the field.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
boltosaurus
Starting Member
7 Posts |
Posted - 2011-11-28 : 08:14:33
|
| my fault - your solution works!thanx a lot! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 08:16:51
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-11-28 : 08:34:37
|
| Note that this is language dependent and same code will not work if the language of the server is not EnglishMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 08:39:24
|
quote: Originally posted by madhivanan Note that this is language dependent and same code will not work if the language of the server is not EnglishMadhivananFailing to plan is Planning to fail
I've already specified it see suggestion at 11/28/2011 : 07:43:08------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-11-28 : 08:40:43
|
quote: Originally posted by visakh16
quote: Originally posted by madhivanan Note that this is language dependent and same code will not work if the language of the server is not EnglishMadhivananFailing to plan is Planning to fail
I've already specified it see suggestion at 11/28/2011 : 07:43:08------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Yes I did not notice it MadhivananFailing to plan is Planning to fail |
 |
|
|
boltosaurus
Starting Member
7 Posts |
Posted - 2011-11-29 : 09:44:39
|
quote: Originally posted by madhivanan Note that this is language dependent and same code will not work if the language of the server is not EnglishMadhivananFailing to plan is Planning to fail
Hi!What do you mean when you say "language of the server"? Do you mean COLLATION? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-29 : 11:14:27
|
quote: Originally posted by boltosaurus
quote: Originally posted by madhivanan Note that this is language dependent and same code will not work if the language of the server is not EnglishMadhivananFailing to plan is Planning to fail
Hi!What do you mean when you say "language of the server"? Do you mean COLLATION?
Nope. Not only that. The server where sql server is installed has a language setting also. to check it seeselect @@language------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
boltosaurus
Starting Member
7 Posts |
Posted - 2011-11-29 : 12:29:42
|
Got itThanxquote: Originally posted by visakh16
quote: Originally posted by boltosaurus
quote: Originally posted by madhivanan Note that this is language dependent and same code will not work if the language of the server is not EnglishMadhivananFailing to plan is Planning to fail
Hi!What do you mean when you say "language of the server"? Do you mean COLLATION?
Nope. Not only that. The server where sql server is installed has a language setting also. to check it seeselect @@language------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-29 : 12:30:21
|
| npyou're wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|