var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: removing partial string from column
how do i update a table which has like two strings in 1 column like
blog, joe ?
i want to strip the joe into a new field and the blog into another field
set firstname= substring(firstname,charindex(' ',firstname)+1 ,len(firstname))
i managed to strip the first name which is the string at the back but not the last name which is the string at the front
Last edited by jcwc888; 10-11-05 at 11:20.
Try this to get the lastname:
lastname = left(column1, patindex('%,%', column1) - 1)
The error message was :-
set lastname = left(lastname, patindex('%,%', lastname) - 1)
Server: Msg 536, Level 16, State 3, Line 1
Invalid length parameter passed to the substring function.
The statement has been terminated.
Dario D'Alessandro, Dario
Stan Dickson, Stan
Ray John, Ray
Juan Sanchez, Juan
I trying to remove the Dario
Gotta make sure there is at least one comma, or it errors out. Try this:
set lastname = left(lastname, charindex(',', lastname + ',') - 1)
Thanks that did actually work.. not sure how that charindex worked. i was using to REPLACE statements to make it work. It was more efficient using your method.
If you need a method of parsing name strings into component parts, I have a UDF that will do that too.