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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 copy a column of prices to another column for all

Author  Topic 

kitfox69
Starting Member

13 Posts

Posted - 2008-05-13 : 16:33:21
I am trying to copy an entire column of pricing into another price column.

Basically we use item_prc_1, item_prc_2, item_prc_3 to set different pricing structures. There are 52000+ SKUs in this table and I want to copy all item_prc_1 data to item_prc_2.

I also want to be able to constrain the data copied based on item_cat which contains the items category marker.

Brooks C. Davis
IT Administrator\Logistics Manager SFTF LLC dba Ashley Furniture Homestores
DELL POWER EDGE 2850 Dual Core Xeon x3 = 1xDB 1xSQL 1xTS | DELL POWEREDGE 2950 Quad Core Xeon = 1xTS | SERVER 2003 | MS SQL 2005 | PERVASIVE EMBEDDED V.9

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-13 : 16:45:08
UPDATE yourTable SET item_prc_2 = item_prc_1

You were not clear on your constraints, so I don't know how to code that part. But perhaps just add a WHERE clause.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

kitfox69
Starting Member

13 Posts

Posted - 2008-05-13 : 17:02:47
Did not think it was that simple.

I was under the impression that a simple set = statement would only set one consistent value to all rows in the specified column.

Thanks for your help!



Brooks C. Davis
IT Administrator\Logistics Manager SFTF LLC dba Ashley Furniture Homestores
DELL POWER EDGE 2850 Dual Core Xeon x3 = 1xDB 1xSQL 1xTS | DELL POWEREDGE 2950 Quad Core Xeon = 1xTS | SERVER 2003 | MS SQL 2005 | PERVASIVE EMBEDDED V.9
Go to Top of Page
   

- Advertisement -