SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 bulk insert
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

raindear
Yak Posting Veteran

64 Posts

Posted - 12/04/2013 :  09:33:20  Show Profile  Reply with Quote
Hi

I have two tables joined by one common value Variant ID

In table2 I have a field called SalePrice

In table1 I have the following fields

ExtendedPriceID,ExtendedPriceGUID,VariantID,CustomerLevelID,Price,ExtensionData,CreatedOn,UpdatedOn

The table is currently empty but the ExtendedPriceGUID is created automatically.

How I can i insert rows that will create a row for any product in table2 that has a SalePrice and then use that as the Price value in table 1?

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 12/04/2013 :  09:49:34  Show Profile  Reply with Quote
what all columns doestable2 have? does it have all other columns required by table1 like ExtendedPriceID,CustomerLevelID,ExtensionData,CreatedOn,UpdatedOn etc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

raindear
Yak Posting Veteran

64 Posts

Posted - 12/04/2013 :  10:08:54  Show Profile  Reply with Quote
The only unique identifier that appears in both tables in VariantID
Go to Top of Page

raindear
Yak Posting Veteran

64 Posts

Posted - 12/04/2013 :  10:30:43  Show Profile  Reply with Quote
Full set is

Variant ID, VariantGUID, IsDefault, Name, Description, SEkeywords, SEdecription, Colors, ColorSKUModify, Sizes, SizeSKUModify, FroogleDescription,ProductID, SKUSuffix,ManufacturePartNumber,Price,SalePrice,Weight,MRSP,Cost,Points,CreatedOn,UpdatedOn
Go to Top of Page

raindear
Yak Posting Veteran

64 Posts

Posted - 12/04/2013 :  12:31:07  Show Profile  Reply with Quote
So I need to join the two tables and then insert the Price as the sale price?
Go to Top of Page

badlydressedboy
Starting Member

4 Posts

Posted - 12/05/2013 :  00:53:35  Show Profile  Reply with Quote
Variant ID is a foreign key in table 1 - pointing at what looks like the primary key in table 2.
Insert new rows into table 1 and include the variant ID that points at the desired/existing price row in table 2.

---------------------------------------------------------------------------------------------------------------------
Performance Tuning & Monitoring Software: www.minidba.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 12/05/2013 :  01:33:36  Show Profile  Reply with Quote
quote:
Originally posted by raindear

So I need to join the two tables and then insert the Price as the sale price?


what about other columns?
where will you get the value for them?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000