|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Okay, after I got everything imported, I found that a few thousand columns had "Shifted" on me. So now I am trying to "Shift them over" to where they need to be.
I did this: INSERT INTO dbo.TABLENAME (COLUMN_NAME_TO_BE POPULATED) SELECT COLUM_NAME_OF_INFO_TO_BE_MOVED FROM dbo.TABLENAME WHERE MFG = 'MANUFACTURER_NAME' AND PN LIKE '8888888888' GO I populated the PN column with 8888888888 to use as a reference point, and the MFG column already was populated with the correct name, so I was using those as my unique reference points. Other columns that have the same MFG name are correct, so I have to use two unique identifiers to specify the actual data that needs to be moved. It inserted 'NULL' in the whole table after I ran it in the Query Analyzer. It appeared to disregard the WHERE statement all together Any ideas on what I am doing wrong here? Is there a way to move the data from one column to the next one over by specifying other WHERE criterias? |
|
#2
|
|||
|
|||
|
Ask a stupid question and the answer slaps you in the face
Well, it was good to get the question out there, now here is the solution I did that worked:
SELECT COLUM_NAME_OF_INFO_TO_BE_MOVED FROM dbo.TABLENAME WHERE MFG = 'MFG_NAME'AND PN LIKE'8888888888' UPDATE dbo.BELLCORE SET COLUMN_NAME_TO_BE POPULATED = COLUM_NAME_OF_INFO_TO_BE_MOVED WHERE MFG = 'MFG_NAME'AND PN LIKE'8888888888' GO I checked the results and it worked like I wanted, I think. SO far so good....... Thank you all for being the sounding board for frustrating moments............. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Move Data From one column to another in same table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|