[dba-SQLServer] Update without using a view

Robert Stewart robert at webedb.com
Sun Mar 7 11:27:48 CST 2010


John,

I think that it is simpler than that.

UPDATE  dbo.AZSMKRevalidate
SET Zip5 = LEFT(Zip9, 5),
         Zip4 = RIGHT(Zip9, 4)
GO


Robert


At 12:00 PM 3/6/2010, you wrote:
>Date: Fri, 05 Mar 2010 15:39:05 -0500
>From: jwcolby <jwcolby at colbyconsulting.com>
>Subject: Re: [dba-SQLServer] [dba-VB] Update without using a view
>To: "Discussion concerning Visual Basic and related programming
>         issues."        <dba-vb at databaseadvisors.com>,  Sqlserver-Dba
>         <dba-sqlserver at databaseadvisors.com>
>Message-ID: <4B916BE9.6020506 at colbyconsulting.com>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>And of course I figured it out.
>
>WITH T1 AS
>(SELECT  LEFT(Zip9, 5) AS SplitZip5, RIGHT(Zip9, 4) AS SplitZip4, Zip5, Zip4
>FROM dbo.AZSMKRevalidate)
>
>UPDATE T1   SET  [Zip5] = [SplitZip5]
>        ,[Zip4] = [SplitZip4]
>GO
>
>Sorry for the ring.
>
>John W. Colby



More information about the dba-SQLServer mailing list