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
halifaxmanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Lee SavidgeConnect With a Mentor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.