Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Want to populate Col B (Datetime) from last 10 characters of Col A (nvarchar)

$
0
0
Hi all,Got a bunch of date data in the wrong column, I'd like copied into a column on the same table. Here's as far as I've got: Update dbo.ReadingList --SELECT convert (Datetime, RIGHT(Title, 9)) Set Date SELECT RIGHT(Title, 10)From ReadingListWHERE ReadingList.Date is null And ReadingList.Title not like 'Strong - Stronger.%'And ReadingList.Title not like '%le force.'Sample data: (sorry not sure how to enable grid view here Title Date'She wishes she hadn't 30/Mar/03' , 'NULL'As you see the title ALSO contains the date. But above code gives a syntax error, also I'm not sure if Update is even the right statement - anyone have the right code?

Viewing all articles
Browse latest Browse all 3145

Trending Articles