• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

REPLACE Query

I have data in a field as follows, a couple of examples are

[dbo].[Jonh Bloggs]
[dbo].[The Results Home Page]

I am looking to remove [dbo].[] so I would ber left with

Jonh Bloggs
The Results Home Page

The database is SQL 2008
0
halifaxman
Asked:
halifaxman
  • 2
1 Solution
 
Lee SavidgeCommented:
update mytable set myfield = replace(replace(myfield, '[dbo].[', ''), ']', '')
0
 
Lee SavidgeCommented:
Or:

update mytable set myfield = right(left(myfield, len(myfield) - 1), len(left(myfield, len(myfield) - 1)) - 7)

But the replace above is better :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now