Droptopper
Droptopper

Reputation: 11

How update part of record, SQL Server 2008

Is there a way to update a part of a record in SQL Server 2008

I have a table looking like:

Name             Country Name(1)
Tulipa Apeldoorn FRA     Tulipes Apeldoorn
Tulipa Abba      FRA     Tulipes Abba
Tulipa Rai       FRA     Tulipa Rai
Tulipa Ozz       FRA     Tulipa Ozz

Now I want all records to begin with Tulipes...

What's the fastest way?

Upvotes: 1

Views: 50

Answers (2)

Navneet
Navneet

Reputation: 447

select * from <myTable> where [name(1)] like 'Tulipes%'


Name             Country Name(1)
Tulipa Apeldoorn FRA     Tulipes Apeldoorn
Tulipa Abba      FRA     Tulipes Abba


update <myTable> set [name(1)]='your text'  where [name(1)] like 'Tulipes%'

Upvotes: 2

Edi G.
Edi G.

Reputation: 2422

You can filter with the where-clause

UPDATE myTable
SET *name = REPLACE(*name, 'Tulipa', 'Tulipes')
WHERE *name like 'Tulipa%'

*name = your columnname

Upvotes: 2

Related Questions