Showing posts with label contains. Show all posts
Showing posts with label contains. Show all posts

Monday, March 12, 2012

move row data

I have a row that contains invalid information. I have created another row
with the correct data. each row has a sequence number on it. The other two
fields in each row contain binary data. how can I move the binary data from
one row into the incorrect row and maintain the sequence number that is
already involved?--Record the sequence number of the row with incorrect information, and then
--delete it. Assume incorrect your identified by sequence number 12345
DELETE FROM [YourTable] WHERE [SequenceColumn] = 12345
--Copy the information from the row with the corrected values. Assume row
--with corrected values identified by sequence number 67890
SET INDENTITY_INSERT [YourTable] ON
INSERT INTO [YourTable]
([SequenceColumn] , [Other Columns...]) --must list all columns
SELECT 12345, [Other Columns....]
FROM [YourTable]
WHERE [SequenceColumn] = 667890
SET IDENTITY_INSERT [YourTable] OFF
--Delete the row where corrected values where copied from
DELETE FROM [YourTable] WHERE [SequenceColumn] = 67890
"Dgragg" wrote:

> I have a row that contains invalid information. I have created another ro
w
> with the correct data. each row has a sequence number on it. The other t
wo
> fields in each row contain binary data. how can I move the binary data fr
om
> one row into the incorrect row and maintain the sequence number that is
> already involved?