Update column to insert spaces in one of the columns in sql server table
How do I achieve the following by a stored procedure or sql script in sql server?
Say for example, I have a-b in one of the columns and I need to update that column to a - b instead. How do I insert spaces before and after the dash in existing data in my da开发者_高级运维tabase.
UPDATE YourTable
SET YourColumn = REPLACE(YourColumn, '-', ' - ')
update TableName set ColumnName = Replace(ColumnName, '-', ' - ') where SomeCondition ...
精彩评论