|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Replacing values via Update Query.
I'm trying to write an Update query that will convert all of the State names in my table to their two character abbreviations.
I wrote the following but there has to be a better way to do the rest. UPDATE RepUpdate SET State = 'MD' WHERE State = 'Maryland' |
|
#2
|
||||
|
||||
|
there is
you need a table with the state codes and names then your query is something like Code:
update RepUpdate
set State = t2.code
from RepUpdate t1
inner
join Statecodes t2
on t1.State = t2.name
Last edited by r937 : August 14th, 2004 at 06:34 AM. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Replacing values via Update Query. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|