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
 Transact-SQL (2000)
 WHy does it not work?

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2002-04-18 : 16:33:08
I am trying to update a column in a table based on information from a cloumn in a differant table. This is the code I have been able to come up with from 3 differant people on this question, but it does not change it. Does anyone know why it is not working and what code I need to use to get it working? And please people don't give me a link to another post that is all people have been doing and it aint helping!

Table names: Publicinfo, privetinfo
Coulmn names: Doing, doing
When the doing in privetinfo has anything starting with "Learning"
I want the publicinfo doing column to be changed to "Learning a move"

Here is my code:

update publicinfo set
publicinfo.doing = 'Learning a move'
from publicinfo, PrivetINFO
where publicinfo.F_PlayerID = privetinfo.F_PlayerID
and PrivetINFO.doing = 'Learning%'

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-18 : 16:40:17
When using the pattern matching flags like '%' and '_', you have to use LIKE instead of =:

update publicinfo set
publicinfo.doing = 'Learning a move'
from publicinfo, PrivetINFO
where publicinfo.F_PlayerID = privetinfo.F_PlayerID
and PrivetINFO.doing LIKE 'Learning%'


Also try this:

update P set
doing = 'Learning a move'
from publicinfo P INNER JOIN PrivetINFO PI ON P.F_PlayerID = PO.F_PlayerID
WHERE PI.doing LIKE 'Learning%'


Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-04-19 : 06:37:45
Eagle, you have posted this question earlier too( http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=14946
) and it has been answered. if only you would have cared to look at it.i have noticed that this isnt the first time you did this. you have to understand one thing, we dont get any fun in giving links to people if they dont help. AND it irritates when people double posts taking valuable time of the members who try to help people .
quote:

And please people don't give me a link to another post that is all people have been doing and it aint helping!




--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -