Sybase SQL Question – Remove percentage sign from values in table

Solution:

If your DBMS does NOT have a “replace” function, you will have to use character substitution using several string functions.

Here is an example in Sybase and SQL Server.

UPDATE YourTable

SET YourColumn = stuff(YourColumn, patindex(YourColumn, ‘%’), 1, NULL)

This says find the pattern of ‘%’ in YourColumn. Now use that position number and replace aka stuff the character with NULL instead.

Good SQL, good night.

Please leave a reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s