Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I have a db in which a company has over 100 products that we use. The company recently changed names and now I need to reinput the product list for the new company. Is there a simple way to "copy" all the products from company A and insert them as company B?Regards,Mike
We would like to keep the old company A and Company B seperate for historic purposes as we add and remove products frequently. I doing so, I would need to recreate all the products currently under company A, under company B. I was looking for a simple sql script to accomplish this.Regards,Mike
I am unsure what information you need other than a table layout, so here you go.Product Table design:PIdxCompany IdxPCodePNamePDescriptionPHeightPLengthPWidthPPriceI was thinking about loading the values for all products from company A (Company Idx 6) into a temp table and then inserting those values back into the product table while changing the Company Idx to 9, but I am unsure exactly how to write something like this.Regards,Mike
Lamprey
Master Smack Fu Yak Hacker
4614 Posts
Posted - 2011-06-14 : 12:35:18
Should just be a simpe insert statement. Something like: