Home:ALL Converter>update script stored procedure sql server2008

update script stored procedure sql server2008

Ask Time:2012-09-21T22:51:39         Author:user1689111

Json Formatter

I am fairly new to posting questions i greatly appreciate your support. I wanted to write a proc to update my table testAd.

A replace function could do it but I have almost a million records to update and I am trying to use stored procedure.

Could you have a look at what I have started? Thank you I appreciate it. I should come up with something by end of day today..a kind of tough situation. I tried the one below it doesn't seem to be working.

CREATE PROC [dbo].[testAd]
AS
DECLARE @ci  VARCHAR (255)
UPDATE Stage.TestAdd
SET @ci=AddressOne
SET @ci= CASE @ci
 WHEN 'Des Moines'  THEN 'IA' 
 WHEN 'Seattle'    THEN 'WA'
 WHEN 'Pheonix'    THEN 'Az'   
 WHEN 'Phx'   THEN 'Az'
 .
 . 
 ELSE @ci

END

Author:user1689111,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/12532935/update-script-stored-procedure-sql-server2008
yy