Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Command to replace a substring within a text column
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Command to replace a substring within a text column
Environment versions
SQL Server:
SQL Server 2005
Application:
Web
Miscellaneous
Thread ID:
01371396
Message ID:
01371396
Views:
59
Hello all,

I need to write a SQL UPDATE statement that will replace a substring within a column with a blank. The substring to replace can be any value so I cannot search on this, but I do know that the value to replace is between known values. The column is a varchar that has descriptive values in it as follows:

'Buy xxxxxx vSymbol @.....Sell yyyyyy vSymbol @....'

The 'Buy' and 'Sell' are constant. The vSymbol is variable but will be the same in the column and there is another column in the table that has this value so it can be referenced in the update statement. The xxxxxx and yyyyyy are variable and might not have the same value but these are to be replaced with a blank (along with the vSymbol). The '@' sign is also constant. I want the end result column to be as follows:

'Buy @...... Sell @'

TIA
Next
Reply
Map
View

Click here to load this message in the networking platform