ccrookston
08-07-2006, 11:07 AM
In MS SQL, how would you drop the last character of a string?
SELECT
main_heading,
LEFT(sub_heading,len(sub_heading)-1) AS sub_heading
FROM temp_headings
That query errors out. It doesn’t like the -1, which is really annoying.
SELECT
main_heading,
replace(sub_heading,right(sub_heading,1),'') AS sub_heading
FROM temp_headings
That query replaces all instances of the last character, and not just the last character itself.
??????????
Any advice would be great!!!
SELECT
main_heading,
LEFT(sub_heading,len(sub_heading)-1) AS sub_heading
FROM temp_headings
That query errors out. It doesn’t like the -1, which is really annoying.
SELECT
main_heading,
replace(sub_heading,right(sub_heading,1),'') AS sub_heading
FROM temp_headings
That query replaces all instances of the last character, and not just the last character itself.
??????????
Any advice would be great!!!