Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update Query

Author  Topic 

Babli
Yak Posting Veteran

53 Posts

Posted - 2007-05-16 : 06:19:22
I have a table called Flag in which there are values for the column FlagImage as

United Kingdom
Costa Rica

I want to replace the space by %20 so that i get

United%20Kingdom
Costa%20Rica

I used the below query but got an error "Sub query returned more than 1 value.This is not permitted when the subquery follows..."

Update Flag set FlagImage = replace(FlagImage,' ','%20')

How shall I update the column FlagImage in a single query

nr
SQLTeam MVY

12543 Posts

Posted - 2007-05-16 : 06:53:33
Do you have a trigger on the table? That doesn't look like an error that could come from that statement.

I would consider leaving the value as it is and change it when it is extracted.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-16 : 06:54:11
[code]declare @t table (flag varchar(100))


insert into @t
select 'United Kingdom' union all
select 'Costa Rica'

Select flag from @t

update @t
set flag=replace(flag,' ','%20')

Select flag from @t
[/code]

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-16 : 06:55:06
your query looks fine to me.

update Flag
set FlagImage = replace(FlagImage, ' ', '%20')


Are you sure you are posting the entire query here ?


KH

Go to Top of Page

Babli
Yak Posting Veteran

53 Posts

Posted - 2007-05-16 : 07:38:27
There is no trigger associated with the table nor there is any constratint.

I am replace the space with %20 while extracting the data.

Thanks to the above idea.


quote:
Originally posted by khtan

your query looks fine to me.

update Flag
set FlagImage = replace(FlagImage, ' ', '%20')


Are you sure you are posting the entire query here ?


KH



Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-16 : 11:04:45
So, did you get the problem solved?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -