Count Quantity Of Payments With 20000 Step

Jan 17, 2014

My need is to count the quantity of payments with 20000 step.

This is my Oracle code. I'm in process of moving from Oracle to SQL Server. How to rewrite this code for SQL Server.

WITH got_grps AS
(
SELECT TRUNC (sys_creation_date) AS date_creation
, ( 1
+ FLOOR ( NVL (amount_original, 0)

[Code] ....

View 1 Replies


ADVERTISEMENT

Count Quantity Of Payments With 20000 Step

Jan 17, 2014

My need is to count the quantity of payments with 20000 step. This is my Oracle code. I'm in process of moving from Oracle to SQL Server. How to rewrite this code for SQL Server.

WITH got_grps AS
(
SELECT TRUNC (sys_creation_date) AS date_creation
, ( 1

+ FLOOR ( NVL (amount_original, 0)
/ 20000

[Code] ......

View 1 Replies View Related

Power Pivot :: Calculate Sales Quantity Since Last Inventory Count?

Sep 30, 2015

I have an inventory table with the following columns

[Item], [Quantity], [Date]

I have a sales table with the following columns

[Item], [Customer], [Quantity], [Date]

In addition to this I have a normal date table.

I want to create a measure that calculates

CurrentInventory:=LastInvenoryCountInTable-SalesQuantitySinceThen

I don't know where to start. Is this possible to do with DAX?

View 10 Replies View Related

Transact SQL :: Get Max Date From Table Where Quantity Require Big From Quantity Shipped?

May 8, 2015

I need sql query to select max date shipment where sum of quantity required > sum of quantity shipped from sales line table but i dont know how to make my sales line table as following

shipment date   quantity required  quantity shipped

07/05/2015          200                             100
07/05/2015          300                             300
07/05/2015          100                              50
06/05/2015          200                             100
06/05/2015          200                             200

Here the result of query i need is   max shipment date is 07/05/2015 and quantity required is  600 and quantity shipped is 450 so tat i must select this date because quantity Required is big from quantity shippedmy question How i write the query get result above in sql server 2005.

View 9 Replies View Related

SQL Server 20000 Syslogins

Aug 24, 2000

Just installed SQL Server 2000 Beta 2. I have a procedure that selects the suid from the syslogins table from a SQL 7.0 version that is now saying that column is not valid.
All the documentation I can find still refers to that being a valid column.
Any suggestions?

View 1 Replies View Related

Sample Files From The Book SQL Server 2005 Reporting Services Step By Step

Jan 18, 2008



Hi All,

Please let me know where can i find the sample files and rs2005sbsDW database in msdn library as i dont have CD provided along with the book.

Please give me the link of the sample files so that i can download it for testing the sample application.

Regards,
Prabhanjana

View 1 Replies View Related

Step By Step SQL2000 Failover Cluster Upgrade To SQL2005

Oct 13, 2006

is there such a paper? if so, can you pls point me to it? thx in advance

View 4 Replies View Related

Step By Step To Publish/deploy The Report Project To The User Pc ?

Oct 3, 2007

hye everyone,

after finished do the report and deploy at IIS/report manager in local pc..

i want to know , what is the step /how to deploy the report project at the user's pc/ client pc /other server..


thanks in advance
thank you very much

View 16 Replies View Related

Reporting Services :: How To Convert RDL File To RDLC Step By Step

Jun 18, 2012

I want to convert .rdl  to .rdc need full steps.Actually i created .rdl report using sp sucessfully.Now i want to convert it to rdlc while doing it iam getting some authentication error and some thing else.I created rdl in 2008 and i want to change it to rdlc 2010.

View 5 Replies View Related

Execute Package Results Different To Step By Step Execution - Uses Raw File

Jan 31, 2007

I have a package that has multiple data flow tasks. At the end of a task, key data is written into a raw file (file name stored in a variable) that is used as a data source for the next task. Each task requires a success from the preceding task.

Here's the rub:

If I execute the entire package, the results of the package (number of records of certain tasks) differs significantly from when I execute each step in the package in turn (many more records e.g. 5 vs 350).

I get the feeling that the Raw file is read into memory before it is flushed by the previous task, or that the next task begins preparation tasks too early.

Any help is greatly appreciated.

I am running on Server 2003 64 (although the same thing happens when deployed on a Server 2003 32 machine)

Thanks

B.

View 2 Replies View Related

How Can I Get A List Of The Last Payments

Apr 21, 2008

How can I get a list of the last payment for each client?
SELECT ClientID,PaymentDate,PaymentAmount FROM tblClients INNER JOIN tblPayments ON tblPayments.ClientID = tblClients.ClientID

View 3 Replies View Related

Many Year Payments

Jan 16, 2004

I need to create a stored procedure that will show all clients that have made payments every year for a number of years (3) or (5). My tables are simple but I have no clue how to ask the SQL question, mostly because it is each and every year.

tblClients ClientID (pk)
tblOrders OrderID (pk) ClientID (fk)
tblOrderPayments PaymentID (pk) OrderID (fk)

Thanks for any help,

View 8 Replies View Related

Step-by-step Deployment Of Single-user Database App?

Mar 2, 2008

Hi!

I hope the answer is as simple as the question -- but after reading all the documentation I could find (understand?) and a lot of posts here, I'm no closer to achieving the goal.

I have a Visual C# app, DAYTRACKER, developed in VS2005. It uses a database with several tables constructed using SQL Server 2005 Developer Edition.

I want to deploy the app plus the database plus SQL Express to another machine, to be used by a single user (the administrator) with no need for network connectivity of any kind.

What I have so far is:
1. The application is successfully deployed from a CD-ROM, having used the Publish process within VS2005, and opens on the new machine -- without database connectivity, however.
2. SQL Express is successfully deployed (it deployed as a 'prerequisite' when I went through the Publish process in VS2005)
3. I manually copied the database's .mdf and .mdl files, using SQL Server Managers 'Copy Database' function, then transferred the copies to the new machine into the ..MSSQL.1MSSQLdata folder (where they appear along with the master.mdg, mastlog.ldf etc files)

Now, the DAYTRACKER application's DAYTRACKERConnectionString under 'Settings' in the VS2005 studio reads 'Data Source=DELL3;Initial Catalog=DayTracker;Integrated Security=True' (which are the appropriate parameters for the machine, DELL3, on which I wrote the program.)

The problem, of course, is that SQL Express on the new machine doesn't connect the application to the database. When I go to the 'SQL Server Configuration Manager' and go to the 'SQL Server 2005 Services' and double-click on the 'SQL Server (SQLEXPRESS)' icon (the service is running) and the user is logged on using 'Local System Account'. Under the 'Service' tab the Host Name is 'MUSIC' (which is the name of the new machine I've installed the app onto -- which of course is not the name - DELL3 - that the app's connection string is expecting). Under the 'Advanced' tab, I've tried correcting the name of the Startup Parameters default .mdf and .mdl entries to ..DayTracker.mdf and ..DayTracker_log.mdl, but the server won't start up after I make the changes.

What I'm hoping for: a step-by-step way of doing this type of deployment, preferable getting it all onto one CD-ROM, and installing it on the new machine so that it all works seamlessly from the start, not requiring any 'tweaking' of the SQLServer Express settings by the end-user.

But I'll take pretty much anything that fixes the specific db connectivity problem I've described.

Thank you very much.

John F.

View 11 Replies View Related

How Can I Get My Code To Look For Partial Payments

Apr 12, 2008

The following code accepts a couple of parameters and creates a temp table to hold unpaid schedule rows (like invoices). Then is takes the payment amount passed and starts paying the oldest ones first, until it runs out of money or pays a partial. When it pays it inserts a row in the applieds table with the schedule_ID, Receipt_ID (payment id), applied amount, and applied date.
What I need help with is: Say there is a partial payment from a previous payment, I need to pay that one, but only the unpaid part. Then continue to pay other schedule rows...
I appreciate any help,
@PaymentAmount money,@PledgeID Int,@Receipt_ID IntAS-- Get unpaid reminder rows for the passed in pledge id and put them into the temp tableDeclare @temp_oldest Table(PledgeSchedule_ID int,ReminderDueDate datetime,AmountDue money)INSERT INTO @temp_oldest SELECT PledgeSchedule_ID, PledgeDueDate, AmountDueFROM tblPledgeReminderScheduleWHERE (dbo.tblPledgeReminderSchedule.Pledge_ID=@PledgeID) AND (dbo.tblPledgeReminderSchedule.ReceivedDate IS NULL) -- AND (dbo.tblPledgeReminderSchedule.PledgeDueDate < GETDATE())WHILE((SELECT Count(*) FROM @temp_oldest)>0)BEGIN-- If the payment is greater or equal to the amount due for the current row, do thisIF(@PaymentAmount >= (SELECT Top 1 AmountDue FROM @temp_oldest))BEGIN-- Update the reminder row with todays dateUPDATE tblPledgeReminderSchedule SET ReceivedDate = GETDATE()WHERE PledgeSchedule_ID = (SELECT Top 1 PledgeSchedule_ID FROM @temp_oldest)-- Insert a row to track applied payment and reminder row associatedINSERT INTO tblPledgeReminderSchedule_Applieds (PledgeSchedule_ID,Receipt_ID,Applied_Amount,Applied_Date)(SELECT Top 1 PledgeSchedule_ID,@Receipt_ID,AmountDue,GETDATE() FROM @temp_oldestWHERE PledgeSchedule_ID = (SELECT Top 1 PledgeSchedule_ID FROM @temp_oldest))-- Subtract the amountdue from the paymentamount and reset itSET @PaymentAmount = (@PaymentAmount - (SELECT Top 1 AmountDue FROM @temp_oldest))ENDELSEIF(@PaymentAmount < (SELECT Top 1 AmountDue FROM @temp_oldest))BEGIN -- Insert a row to track applied PARTIAL payment and reminder row associatedINSERT INTO tblPledgeReminderSchedule_Applieds (PledgeSchedule_ID,Receipt_ID,Applied_Amount,Applied_Date)(SELECT Top 1 PledgeSchedule_ID,@Receipt_ID,@PaymentAmount,GETDATE() FROM @temp_oldestWHERE PledgeSchedule_ID = (SELECT Top 1 PledgeSchedule_ID FROM @temp_oldest))BREAKENDELSEIF @PaymentAmount = 0-- Delete all rows from temp tableDELETE FROM @temp_oldestELSE-- Delete only the current row from the temo tableprint @PaymentAmountDELETE FROM @temp_oldest WHERE PledgeSchedule_ID = (SELECT Top 1 PledgeSchedule_ID FROM @temp_oldest)END 

View 1 Replies View Related

Help With Udf Or Where Cluase To Get Quarterly/annual Due Payments

Jan 9, 2008

I'm trying to build a where clause that looks at two columns to determine if QUARTERLY and ANNUAL payments are due.
rec_day could be any day.
I got the monthly one pretty easily:
WHERE rec_start <= GETDATE() AND rec_frequency = 'Monthly' AND rec_day = DAY(GETDATE())
So if the rec_day was 9 and the rec_frequency was 'Quarterly' then I would be looking to see if todays date is 1/9 or 4/9 or 7/9 or 10/9 (not sure how I do this part)
I'm pretty much stuck on where to go with the quarterly where clause:
WHERE rec_start <= GETDATE() AND rec_frequency = 'Quarterly' AND rec_day = ????
 
I tried the following, but it did not work:
(CAST(DATEPART(Q, GETDATE()) * 3 - 2 AS VARCHAR(2)) + '/' + CAST(rec_day AS VARCHAR(2)) + '/' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) = GETDATE())

View 1 Replies View Related

Transact SQL :: Picking Up Average Last Two Payments

May 18, 2015

Got a table named Payments in the following form:

Report_DateCustomer_IDCustomer_NamePayment_DatePayment_Amount

The Customers Table have the fields:

Customer_IDCustomer_Name

Since the Customers Table contains the complete list of customers I seek to have a Join made between it and the Paymentstable to check the amount made by the customers.

However, the trouble arises when I seek to check the average amounts made by each customer during last two months in which such a customer had paid.

In further clarification, lets consider current month of May 2015 going on;

Customer_A had paid $10,000 in AprilCustomer_A had paid $5,000 in AprilCustomer_B had paid $10,000 in AprilCustomer_A had paid $18,000 in MarchCustomer_A had paid $2,000 in MarchCustomer_A had paid $10,000 in FebruaryCustomer_B had paid $8,000 in FebruaryCustomer_B had paid $4,000 in FebruaryCustomer_B had paid $3,000 in February...

View 4 Replies View Related

How To Read An Database Table Step By Step (with ADO)

May 19, 2008









Hi,
I have to transport a big database table and can't read it at once with "select * from table" because the table is bigger than my system memory.
Is there a way to read the table step by step? I thought it was possible with ADO and his serverside cursors but I don't now how. I need an "universal" solution that works on SQL Server 2000/2005, MySQL and Oracle.

Regards,
harry

View 2 Replies View Related

Enabling T-SQL Debugger (SQL2000) - Step Into, Step Over Etc

Dec 5, 2007

Connecting to a networked SQL Server Box from my local machine


Open Query Analyzer from Start menu, logging in using sa account.

from the object browser i select my stored procedure (WEA_InsertClaim) - right click and select Debug.

i am prompted to enter the parameter values, which i do, auto rollback checkbox is checked - click Execute.

T-SQL Debugger opens and runs through the stored procedure.

but only buttons enabled are the "Go", "Toggle Breakpoint", "Clear All Breakpoints"

so i can set breakpoints etc. but when i select Go it will not stop at the breakpoints it just runs through the stored procedure from start to finish. giving the correct return code as its output

is there something i need to enable in order to make it stop at breakpoints??

Cheers,
Craig

View 3 Replies View Related

Step By Step For Indirect Configuration

Feb 15, 2006

Is there a good step by step guide to setting up an indirect configuration? I've followed the steps in Kirk Haselden's 'Keep your packages in the dark' article 3 or 4 times this afternoon and nothing seems to work. I cannot even get the XML configuration file to work by accessing it directly. I'm using the wizard to create the file.

Just wondering if there was something else out there....

Thanks in advance for any help.

MarkA

View 3 Replies View Related

SQL Server Agent Job Step Fails When Creating A SQL Server Integration Serveices Type Of Step

Mar 12, 2008

Hi

I posted this on the sql server security forums too. Here is the error that i get when i change the type of the step to ssis

Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
Additional information:
An exception occured while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.(Microsoft SQL Server, Error: 3930)

This error pops up right after i change the type of the step to "SQL Server Intergration Services Package"

I have made the following configurations:

The user group (windows group) that the user belongs has the following roles in msdb :

db_dtsadmin
db_dtsltuser
db_dtsoperator
SQLAgentOperatorRole
SQLAgentReaderRole
SQLAgentUserRole

i have made a proxy to sql server agent which has the following subsystems :

"SQL Server Integration Services Provider" the proxy is tied to the same login which has those SQLagent and dts roles in msdb database.

Im using windows authentication and the user that logs into the sql server is in the same group that i have set all of the rights.

Ps. Clearly im missing some role or right somewhere because as soon as i give the group sysadmin role then all the users in that group can create SSIS steps in the agent.

Ps. Ps. I have been living under the impression that i dont have to give sysadmin rights to people that create ssis packages and schedule then with the agent.

View 3 Replies View Related

Reporting Problems W/ MS SQL Server 2005 Reporting Services Step By Step To MS

Apr 26, 2007

I am trying to learn Reporting Services using the title "MS SQL Server 2005 Reporting Services Step by Step" by Stacia Misner and Hitachi Consulting, published in 2006. I am experiencing problems with some of the exercises. I got as far as Chapter 4 when I followed directions to create a SQL statement to define a query string for a dataset. Pg 80:



select * from vProductProfitability

where year = 2003 and

MonthNumberOfYear = 1



The view vProductProfitability does not exist in the tutorial database that came with the book, rs2005sbsDW. The result of this query is the basis for the entire chapter on developing basic reports and I'm being denied a learning opportunity because the view does not exist. In short, I'm stuck.



I have tried to find somewhere at Microsoft to place this question and get some answers so I can continue thru the tutorial. To no avail. Does anyone have any suggestions?



BTW, the solution that came in the CD is also wrong because the query noted above is also in the solution.



This humble grasshopper seeks wisdom.



Respectfully Submitted,



Dave Matthews

Atlanta, GA

aka FlooseMan Dave

View 17 Replies View Related

Replication Step By Step

Sep 13, 2007

Dear Experts,
please guide me for replcation.....
i'm using sql server 2005 server tools developer edition. my OS is professional 2000.
and i've sqlserver 2000 client tools also

i've two databases in my machine. publisher is in different instance, and the transactions might be maximum 50 per day. my aim is when ever developer enters the data into the main database, automatically it should be updated on the my two databases also.
i mean the server is sysA and the database is srtp.
my machine is sys20 and the databases are srtp1, srtp2.
how should i make sysA as publisher?
i've right click on the server databases, but it is showing newsubscriptions option only.



Vinod
Even you learn 1%, Learn it with 100% confidence.

View 8 Replies View Related

Configuring SQL Server Express In SqL Server 2005 Pro To Support MSVisual C# 2005 Step By Step

Feb 4, 2007

Visual C# 2005 Step by Step €“ John Sharp

Intel D975XBX €“ 930 €“ 2GB ram €“ HD 300GB - MatroxVD
Windows XP Sp2 + updates
Visual Studio 2005 Professional edition
SQL Sever 2005 Standard Edition

20070203
Install Practice Files at D:Program FilesMicrosoft PressVisual C Sharp Step by Step.

Configuring SQL Sever Express Edition
Hostname - xxxxxxxxx..

At sqlcmd €“s xxxxx...SQLExpress €“E got - Pipes error.

Open Microsoft SQL Sever 2005 - Configuration Tools €“ SQL Configuration Manager €“ select Protcols for SQLEXPRESS €“ select Named Pipes €“ enable €“ close.

At sqlcmd €“s xxxxx..SQLExpress €“E get Sqlcmd: €˜ €˜ : Unknown Option. Enter €˜ -? €˜ for help.

Chdir C:Documents and SettingsAll UsersStart MenuProgramsMicrosoft Server 2005
Sqlcmd €“s xxxxxx..SqlExpress €“E
Hresult 0x2, Lvel 16, State 1
Named Pipes Provider: Couldnot open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

How do I fix this?

Need to be able to to use the Northwind Traders data base

Thanks

View 1 Replies View Related

Quantity Balance And Sum

Aug 14, 2007

I have following table structure


CREATE TABLE [dbo].[EMPLOYEE] (
[REC_ID] [int] IDENTITY (1, 1) NOT NULL ,
[EMP_ID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[NAME] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PROJECT_ID] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[LOGIN_ID] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO



CREATE TABLE [dbo].[PPE_STOCK] (
[REC_ID] [int] IDENTITY (1, 1) NOT NULL ,
[PPE_ID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[PPE_NAME] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[QUANTITY] [int] NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[PPE_ITEM_ISSUE] (
[PII_ID] [int] IDENTITY (1, 1) NOT NULL ,
[EMP_ID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[DATE_REQUEST] [datetime] NULL ,
[QUANTITY_ISSUE] [int] NULL ,
[DATE_ISSUE] [datetime] NULL
) ON [PRIMARY]
GO


I want to calcalate the balance quantity avaiable in the stock.

PPE_STOCK => STOCK OF QUANTITY TABLE
PPE_ITEM_ISSUE => STOCK QUANTITY ISSUE TO EMPLOYEE TABLE

query retrieve like this.

Name....EMP_ID....PPE_NAME,..QUANTITY_ISSUE.Stock Qty.Balance Qty
-----------------------------------------------------------------
Martin..p0012456..Safety Gloves 1 .......100........99
Martin..p0012566..Safety Glass 1 .......100........99
Peter...p00123456.Safety Gloves 1........100........98
Jone....p00987654.Safety Helmet 1........100........99
Khan....p0012122..Safety Helmet 1........100........98
....

stock quanity minus the issue qauantity and retreive balance QTY
how ?

How can calcuate / retrieve the balance quantity by the query ?

Please us query calcuation.

regards
Martin

View 3 Replies View Related

Need Help Updating A Quantity In Db Via A Loop

May 16, 2008

When a user orders an amount of a given product, I want to update the available quantity in my db.  I use a loop to insert each ordered product item and the needed quantity into an ORDERED_ITEMS table (these items are tied to an order record in another table).  The available_quantity is in the STOCK table.  Here is my code.  Can you help me out with how I can achieve this? (I know my queries should be in SP's, but for now while I'm getting everything the way I want it, it's easier to write it directly in my code.)
 Thanks!
 //insert the individual items
string items_to_ship = "";

foreach (GridViewRow rw in GridView1.Rows)
{
if (rw.RowType == DataControlRowType.DataRow)
{
if (((TextBox)rw.Cells[4].FindControl("qtyneeded")).Text != "")
{
int qty = Convert.ToInt32(((TextBox)rw.Cells[4].FindControl("qtyneeded")).Text);
int itm = Convert.ToInt32((rw.Cells[0].Text));

SqlConnection mycn2 = new SqlConnection(myConnectionStr);
SqlCommand myCommand4;
SqlDataReader rdr = null;
int new_qty = 0;
myCommand4 = new SqlCommand
("INSERT INTO SHP_ORDERED_ITEMS (ship_id, item_id, quantity) values(@ship_id,@item_id,@quantity);" + "SELECT item_description, qty_available from shp_stock where item_id = @item_id;", mycn2);

myCommand4.Parameters.Add("@ship_id", SqlDbType.UniqueIdentifier).Value = shipmentID; myCommand4.Parameters.Add("@item_id", SqlDbType.Int).Value = itm;
myCommand4.Parameters.Add("@quantity", SqlDbType.Int).Value = qty;

myCommand4.Connection.Open();
rdr = myCommand4.ExecuteReader();
while (rdr.Read())
{
// create a list of item descriptions and quantities of each, for use in the email
items_to_ship += (string)rdr["item_description"] + " (" + qty.ToString() + ")<br>";


}
myCommand4.Connection.Close();

}
}

View 1 Replies View Related

Quantity Of Entrys From Record Set

May 18, 2004

Quantity of entrys from record set
Hi All!

In a database (Access) i have many lines. In one of colomnes (Label) i have entrys "AAA", "BBB", "CCC", ... . I would like to know how many "AAA" and

how many "BBB" we have in database.

Is this possible to achieve this by using i = RecordSet.Fields (Label). ... mixad with other functions where i is an integer and RecordSet a record set?

what a SQL query cal deliver a i as
Integer, where i is quantity of lines
labeled with "AAA".

How can i do this with VBA?

Thank You all!
Alexander

View 1 Replies View Related

Deduct Quantity Of SKU From One DB To Next Database

Jan 3, 2013

currently we have some shipping software that has a mqsql database locally.There are filters on the program and when an item is shipped from our warehouse it goes into a filter "Shipped".We have a SKU and also quantity for the product.

Now we have an inventory program that also has a mqsql database,this has the same SKU as the shipping software database.what we hope to do is when an SKU is shipped in our software program(ie it Goes into the "Shipped" folder),it will deduct the quantity from the adjacent SKU in the inventory program database.

Note that the 2 databases are independent from each other but would like them to be in effect linked to each other.

View 1 Replies View Related

MAX Date Dependent On Quantity

Aug 20, 2013

I am trying to query only the Max date dependant on quantity

Create Table dbo.TestParts
(Part char(30), Desc1 char(50), Desc2 char(50));
Create Table dbo.TestStructure
(Model char(30), Part char(30), EDATE smalldatetime, QtyPer float);
GO
Insert INTO dbo.TestParts Values('101111','Widget A', 'Batteries Not Included'),

[Code] ....

Looking for a return of:

PART Description EDATE QtyPer
101112 Widget B ..... 2012-12-03 3
101113 Widget C ..... 2012-12-03 5
101114 Widget D ..... 2012-12-01 1

Widget A should not show because the last date the qty was changed to Zero

Closest that I have come..........(which is pulling the part 101111 which should be incorrect)

Select ts.Part, RTRIM(tp.Desc1) + ' ' + RTRIM(tp.Desc2) as Description,
ts.EDATE, ts.QtyPer
FROM testing.dbo.TestStructure ts
Inner Join (Select Part,MAX(EDATE) as Date
FROM testing.dbo.TestStructure
WHERE QTYPER <> '0'

[Code] .....

View 3 Replies View Related

Sum Quantity With Like Employee And Itemname

Nov 8, 2014

I have a table Item_used like this

Itemname Employee Quantity
pencil samlopez 10
pencil samlopez 5

All I want is to make a report that sum all the quantity of the same items with the same employee like this

Itemname Employee Quantity
pencil samlopez 15

View 1 Replies View Related

Query Quantity Of Records

Nov 20, 2014

I need to query SQL Server Express 2012 records to find 6 serial numbers that are all assigned to one common unique number. Normally in this use case, 12 serial numbers are assigned to one common unique number, so I'm trying to find the odd entry.

View 2 Replies View Related

Group By Adding The Quantity

Dec 22, 2014

I have the following query

Select FullItemName,
Region, IssuedQuantity
from Transactions.TransactionBaseMain
where EnvironmentID = 34
and ModeID=2 and UnitOfIssueID=73 AND itemid=5605 and TransactionType in ('Issue')
and DATEDIFF(DD,TransactionDate,GETDATE())<30
Group by FullItemName,Region,IssuedQuantity
Order by FullItemName,Region,IssuedQuantity

I need to group the IssuedQuantity by region. (Add up the IssuedQuantity for the region).

View 1 Replies View Related

Breakdown Quantity Field

Sep 20, 2007

I'll give a basic example of my table.
OrderID, ProductID, Quantity
1,1,4

I would like to display the above row 4x (hence qty of 4)
1,1,"item 1"
1,1,"item 2"
1,1,"item 3"
1,1,"item 4"

Any suggestions? Thanks.

View 7 Replies View Related

On Insert Need To Calculate A Quantity

Jan 31, 2008

In my Insert into #TempTable I need to calculate the 'qty_wasted' as difference between 'qty_received' and 'qty_used' Where would I put the calc statement?


CREATE TABLE#TempTable
(
job_date datetime,
job_number char(15),
cost_code char(15),
qty_received decimal(8,2),
qty_used decimal(8,2),
qty_wasted decimal(8,2),
productId char(25),
plant_id char(10)
)


INSERT INTO #TempTable (job_date, job_number, cost_code, qty_received, qty_used, qty_wasted, productId, plant_id)
SELECT dbo.Batch.ReportDate AS job_date, dbo.Job.CompanyJobId AS job_number, dbo.Item.CompanyItemId AS cost_code, dbo.Product.CompanyProductId as productId, SUBSTRING(dbo.Job.CompanyJobId, 1,3) as plant_id,
qty_received = CASE dbo.SourceType.CompanySourceTypeId WHEN 'MA' then SUM(dbo.ProductionEvent.Quantity) ELSE 0 END,
qty_used = CASE dbo.SourceType.CompanySourceTypeId WHEN 'PR' THEN SUM(dbo.ProductionEvent.AlternateQuantity) ELSE 0 END
FROM dbo.Batch INNER JOIN
dbo.Event ON dbo.Batch.BatchGuid = dbo.Event.BatchGuid INNER JOIN.....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved