T-SQL: Parsing Values

Please see my other Database Development articles.

Updating a field with only a portion of its original value.

String functions provide powerful methods for manipulating values in recordsets.
Querying and changing only a portion of a field’s original data is a common requirement from the data layer.
In this example, I have a standard “pages” table that might contain items common to HTML pages.
For example, let’s say you have an “image” field to store the path to a page’s image, maybe it’s header graphic.
However, what if the image name contains underscores within every path being returned?
To avoid those characters from being returned, simply isolate the portion of each image path by using a combination of the string functions: substring(), charindex(), and len().


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Connecting to %s