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.
| Author |
Topic |
|
xrum
Yak Posting Veteran
87 Posts |
Posted - 2010-04-23 : 15:10:35
|
| i need to update one of the columns with something like "ID=[PersonID]" is there a way to pull PersonID from that row, and update all columns at once with the that row's corresponding id?so for example.row one would bepersonID = 1update link column with + "ID=1"row two would bepersonID = 2update link column with + "ID=2"etc... thanks! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-23 : 15:17:33
|
| sorry didnt understand. can you provide a data sample?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
xrum
Yak Posting Veteran
87 Posts |
Posted - 2010-04-23 : 15:29:21
|
| hm... lets say i have 3 columnsuserID --- Name --- Link12 "Bob" "goto=12"23 "John" "goto=23"34 "Mary" "goto=34"45 "Kate" "goto=45"so, right now i already have the ID and the Name populated.I need to run a query to insert values into column "Link". The new values will be "goto=" + [userID]does that make sense? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-23 : 15:32:14
|
yup useUPDATE TableSET Link = 'goto=' + CAST(userID AS varchar(10)) ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2010-04-23 : 15:32:46
|
| Maybe this:UPDATE table_nameSET Link = 'goto=' + CAST(userID AS VARHCAR(20)) |
 |
|
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2010-04-23 : 15:34:33
|
|
 |
|
|
xrum
Yak Posting Veteran
87 Posts |
Posted - 2010-04-23 : 15:38:08
|
| Ahh! That worked! thanks! much easier then i expected :) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-23 : 15:45:17
|
| welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|