Hello to all,
I am a DBA of 8 months so please bear with me. I am working on this prject for the company I am currently with for the past 4 months and I am almost finished. This is one of the last parts that I need to have functioning. I am needing to write a code that will find a particular ProductIdentifier. When this particular ProductIdentifier is found, 1. I need to grab that ProductIdentifier. 2. I need to go 2 rows up, then place that ProductIdentifier in the field that is 2 rows above it.
Here is my code(everything is sorted properly already in this table)
I will better show you what needs to be done
![alt text] : http://ask.sqlservercentral.com/storage/temp/187-picture-of-what-i-need.jpg
What I need for this code to do is this: whenever I find any ProductIdentifier like 'AWRPNS000%', I need for the query to take this and go 2 rows up and replace whatever ProductIdentifier is in this with 'AWRPNS000%'. I then need to insert the results into a table. I believe the best thing to do is to select the ProductIdentifier row again and give it an alias. This will be the row that I need to transform. I can then do a comparison to see if things worked out. A knowledgable SQL user helped me a few days ago with a somewhat diffrent type of solution, but when I tried the same solution with the ProductIdentifier field, I do not get any results. I do not know how to write the code to do the actual grabbing of the ProductIdentifier and going up 2 rows and replacing it. Once again, any help or input would be greatly appreciated. I anyone needs me to add more information please ask.
May 04, 2012 at 08:52 PM