Freddy Sanchez offered handshakes and hugs and bid farewell to the Pittsburgh Pirates before walking some 100 yards down the hallway to his new team.

SAN FRANCISCO — Freddy Sanchez offered handshakes and hugs and bid farewell to the Pittsburgh Pirates before walking some 100 yards down the hallway to his new team.

San Francisco swept the Pirates on Wednesday, then plucked one of their top players.

The Giants acquired Sanchez and made it a convenient switch for the three-time All-Star hours after double-play partner and shortstop Jack Wilson was traded to Seattle.

The teams announced the swap following the Giants' 1-0, 10-innings victory — so Sanchez merely had to change clubhouses to join his new organization, which is in the thick of the NL wild-card race.

"It's crazy," said Sanchez, who's unsure when he'll make his Giants debut because of a knee injury. "I'd be lying if I didn't say it's a little crazy, a little hectic. I'm here for a reason."

Once it was official, Sanchez left the visitor's side and headed to San Francisco's locker room to pull on his new No. 28 jersey and a black Giants cap before being formally introduced.

Indeed. The Giants haven't reached the playoffs since 2003 and have endured four straight losing seasons.

San Francisco sent minor league pitcher Tim Alderson to the Pirates for the 31-year-old Sanchez, the 2006 NL batting champion.

"Simply put, our long-awaited next move has finally been consummated," Giants general manager Brian Sabean said. "A kid that has distinguished himself as an All-Star three out of the last four years and a batting champ within that time frame. The timing's great."

The Giants' medical staff twice examined Sanchez this week to make sure his inflamed left knee was fine. Sanchez was a late scratch Monday night and didn't play at all during the Pirates' three-game series in the Bay Area, giving San Francisco's medical staff ample time to evaluate him. He also sat out Friday night's game at Arizona.

"It's tough coming to a new team not knowing if you can play or not," Sanchez said. "That's the last thing you want to do is come to a new team and be in the trainer's room. I want to get there as soon as I can but I also want to be smart about it."

Sanchez is hitting .296 with six home runs and 34 RBIs, and did not play in this week's series against the Giants because of the knee. He was an All-Star in 2006, 2007 and this year.

He will move into the No. 2 hole in the batting order and be the regular second baseman. Sanchez is 3 for 34 over his last eight games, but hopes to be back on track soon.

It was the second trade of the day for the last-place Pirates, and second swap of the week for the Giants after acquiring infielder-outfielder Ryan Garko from Cleveland on Monday.

Friday is the deadline for teams to make deals without waivers.

"We're relieved this has come to fruition," Sabean said.

So is Sanchez, who had been dealing with the trade rumors since the All-Star break.

"I'm human," he said. "You try to put things in the back of your head and be professional about it but we're all human. It just feels good that it's over with. There was a little uncertainty. Now I can just concentrate and go play and help these guys win."

Pittsburgh sent Wilson and pitcher Ian Snell to the Mariners for shortstop Ronny Cedeno, Triple-A catcher-first baseman Jeff Clement and three minor league pitchers earlier in the day.

Since starting the season with a $48.7 million payroll, ahead of only San Diego and Florida, Pittsburgh has traded what had been its four highest-paid players: Wilson ($7.45 million), Adam LaRoche ($7.05 million), Sanchez ($6.25 million) and Snell ($3.2 million).

"It's just part of the game. It happens," third baseman Andy LaRoche said. "I don't know if this is normal but it's just the way that our brass sees it and our front office feels we need to get us going in the right direction. It's obviously a tough loss losing guys you've become close with and you've played with and the guys you have fun being around and you've gone into battle with. You can't let it really affect you."

With Garko and Sanchez, it gives the club a completely new look on the right side of the infield.

"It's just exciting to be a part of this," Garko said upon learning about Sanchez. "The pitching's so good and we've got real good players. I think we can make a run at it. Coming from Cleveland, where kind of the opposite is going on, as a player, when ownership and the general manager are going out there and getting you help, it's a great thing."