Advertisement

07.23.2008 at 11:07AM PDT, ID: 23589539
[x]
Attachment Details

Help with change quantity in SQL Server

Asked by bpfsr in SQL Server 2005, MS SQL Server, SQL Server 2008

Tags: Microsoft, SQL Server, 2005

In my SQL Server database I have a list of items with a column for quantity. When an item sells, I want to reduce the quantity by 1. I import the sold items into a new table with:
create table DBase_Editor
(ItemID varchar (50) not null)

bulk insert DBase_Editor
from 'G:\DBase Editor.csv'
with
(firstrow = 2,
fieldterminator =',',
rowterminator = '\n')

Can somebody help me with a query that would reduce the Quantity column in table Vendor by 1 for each file in DBase_Editor by matching column 'ItemID' in table DBase_Editor with column 'identifier' in table Vendor? I then need a separate query that would on a second pass delete all records from table DBase_Editor where column 'quantity' is zero. Thank you. Start Free Trial
[+][-]07.23.2008 at 11:22AM PDT, ID: 22072257

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 07:05AM PDT, ID: 22079214

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 07:49AM PDT, ID: 22079752

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Server 2005, MS SQL Server, SQL Server 2008
Tags: Microsoft, SQL Server, 2005
Sign Up Now!
Solution Provided By: mark_wills
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628