Stock Inventory Diagram
Mar 4, 2007
Hi all, i don't know where to post these, and so i posted in here about sql stuff...
I want to do a stock inventory for my restaurant, and i don't know how to start building the database, so, I want to ask if anyone knows if they have a database diagram for stock inventory... any kind of database diagram will helps, so I get and Idea how to start...
thanks...
View 2 Replies
ADVERTISEMENT
Jan 22, 2007
Hello..
I am designing a Database Application that covers Inventory System. And I am now in a dilemma of chosing which design to track Inventory stock better, in performance, reliability, and error free?
1st Design
PRODUCT TABLE
ItemID
ItemName
Price
QtyOnHand
..and other unique info of the product..
SALES TABLE
SalesID
Date
...etc...
SALESDETAIL TABLE
SalesID
ItemID
QtySold
Price
PURCHASE TABLE
PurchaseID
Date
...etc...
PURCHASEDETAIL TABLE
PurchaseID
ItemID
QtyPurchase
Price
...etc...
and similar design with SALESRETURN+DETAIL, PURCHASERETURN+DETAIL, ADJUSTMENT+DETAIL
Tracking Inventory stock is done by using (update, insert and delete) triggers in each of the DETAILS to update the QtyOnHand in the PRODUCT TABLE
2nd Design
PRODUCT TABLE
ItemID
ItemName
Price
...etc...
INVENTORY TABLE
ItemID
QtyBegin
...etc...
SALES TABLE
SalesID
Date
...etc...
SALESDETAIL TABLE
SalesID
ItemID
QtySold
Price
...etc...
and similar design with PURCHASE+DETAIL, SALESRETURN+DETAIL, PURCHASERETURN+DETAIL, ADJUSTMENT+DETAIL
The later design does not hold QtyOnHand, but only save QtyBegin instead. To get the QtyOnHand, it uses views/stored procedure with Union Query, so it looks like this:
QtyOnHand = QtyBegin + Sum(QtySold) + Sum(QtyPurchase) + Sum(QtySalesReturn) + ........
And at the end of a accounting period, the calculation of the QtyOnHand will be the QtyBegin of the next accounting period.
According to you guys, which way is better in PERFORMANCE, RELIABILITY, ERROR FREE, and why? What are the pros and cons of these two?
Thanks a lot.
View 3 Replies
View Related
Sep 11, 2007
helo all...,i want to make procedure like:examplei have table: item (itemid,itemname,stock)orderdetail(no_order,itemid,quantity)itemmoment(itemid,itemname,stock)item table itemid itemname stock c1 coconut 2 p1 peanut 2orderdetail tableno_order itemid quantity 1 c1 5itemmoment tableitemid itemname stock c1 coconut 0 p1 peanut 0 when customer paid, his quantity in orderdetail decrease stock in item table..so stock in item table became:itemid itemname stock c1 coconut -3 p1 peanut 2it's not good, because stock may not minus...so i want to move -3 to itemmoment table..so stock in item table became:itemid itemname stock c1 coconut 0 p1 peanut 2and in itemmoment table became:itemid itemname stock c1 coconut 3 p1 peanut 0my store procedure like:ALTER PROCEDURE [dbo].[orders]( @no_order as integer, @itemid AS varchar(50), @quantity AS INT)ASBEGIN BEGIN TRANSACTION DECLARE @currentStock AS INT SET @currentStock = (SELECT [Stok] FROM [item] WHERE [itemid] = @itemid) UPDATE [item] SET [Stock] = @currentStock - @quantity WHERE [itemid] = @itemid COMMIT TRANSACTIONENDit's only decrease stock with quantity. i want move stock minus from item to itemmoment..can anyone add code to my store procedure?plss.. helpp.thxx....
View 2 Replies
View Related
Apr 23, 2007
I have created a database with several tables. I want to create a database diagram to show the relationshipbetween the tables. Below are the steps from the SQL Server 2005 documentation on how to create a database diagram. The problem is that when I right click on the Database Diagrams folder I am only given two options. They are:"Working with SQL Server diagrams" and "Refresh"There is no menu choice to create a new database diagram. Can anyone tell me what the problem here is?
To create a new database diagramIn Object Explorer, right-click the Database Diagrams folder or any diagram in that folder.
Choose New Database Diagram on the shortcut menu.
The Add Table dialog box appears.
Select the required tables in the Tables list and click Add.
The tables are displayed graphically in the new database diagram.
View 1 Replies
View Related
Mar 12, 2007
Hi! I'm kinda stuck in getting a particularly tricky qurey...
SQL Code:
Original
- SQL Code
SELECT DISTINCTROW Categories.CategoryName, Products.ProductName, Sum(CCur([Order Details].[UnitPrice]*[Quantity]*(1-[Discount])/100)*100) AS ProductSales
FROM (Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID) INNER JOIN (Orders INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) ON Products.ProductID = [Order Details].ProductID
WHERE (((Orders.ShippedDate) Between #1/1/1995# And #12/31/1995#))
GROUP BY Categories.CategoryName, Products.ProductName;
SELECT DISTINCTROW Categories.CategoryName, Products.ProductName, SUM(CCur([ORDER Details].[UnitPrice]*[Quantity]*(1-[Discount])/100)*100) AS ProductSalesFROM (Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID) INNER JOIN (Orders INNER JOIN [ORDER Details] ON Orders.OrderID = [ORDER Details].OrderID) ON Products.ProductID = [ORDER Details].ProductIDWHERE (((Orders.ShippedDate) BETWEEN #1/1/1995# And #12/31/1995#))GROUP BY Categories.CategoryName, Products.ProductName;
The above SQL statement is from the famous Northwind DB and it is called the "Product Sales for 1995" query...
I have Transactions instead of Orders and TransactionDetails instead of [Order Details]
Now, I want something similar... I want to render Dead Stock and Fast Stock... I'm using ComponentOne's Reporting solution and it pretty much like Access.
Anyways, I want to supply a date for TransactionDetail.TransactionDetailDetail as starting date (ending date is always Today()) and within this range, i want to get a list of products that are sorted ascending on Products.ProductUnitSold. This should return a list of products (grouped by category name) showing SubCategoryName, ProductName, ProductUnitPrice, TotalSold...
If total sold is ascending = Dead Stock
If total sold is descending = Fast Stock
View 13 Replies
View Related
Aug 3, 2004
i want to make business portal intellegence with sql2000 as my final project but i don't have datasets. i need iventory datasets like northwind or foodmart or middlewest. somebody help me please!!
View 1 Replies
View Related
Apr 17, 2008
I am designing a BI solution for a large manufacturer. They process big ticket items. They track their inventory by each piece. I need to know where each item is located, where it came from, when it arrived, has it been processed, ect. Along with that I have to be able to run reports by day/week/month/year that shows current inventory levels at any point in time.
What I arrived at for table design is each item will get a row which will include a column for date and another for Add_Remove. When the item is added to inventory it gets a date and a +1 for Add_Remove. When it is removed it gets a new row with a date and a -1 in the Add_Remove column. I should be able to add the Add_Remove column for the selected rows (by location, type, etc) from the beginning of time to any point in time and get a current total. If I'm reporting by month for the year I should be able to add from time(0) to lastitem in January to get January levels, then the same for each successive month.
The problem I can't figure out the MDX code to do that. My basic data set is as follows:
SELECT NON EMPTY { [Measures].[Total], [Measures].[Add Remove], [Measures].[Inventory Weight] } ON COLUMNS, NON EMPTY { ([Ship From].[Ship From Region].[Ship From Region].ALLMEMBERS * [Ship From].[Ship From].[Ship From].ALLMEMBERS * [Date Received].[Date].[Date].ALLMEMBERS * [Date Received].[Year].[Year].ALLMEMBERS * [Date Received].[Month].[Month].ALLMEMBERS) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
( SELECT ( STRTOSET(@Region, CONSTRAINED) ) ON COLUMNS FROM
( SELECT ( STRTOMEMBER(@FromDateReceivedMonth, CONSTRAINED) : STRTOMEMBER(@ToDateReceivedMonth, CONSTRAINED) ) ON COLUMNS FROM
( SELECT ( STRTOSET(@InventoryType, CONSTRAINED) ) ON COLUMNS FROM
( SELECT ( STRTOSET(@Division, CONSTRAINED) ) ON COLUMNS FROM [Heidtman DW]))))
WHERE
( IIF( STRTOSET(@Division, CONSTRAINED).Count = 1, STRTOSET(@Division, CONSTRAINED), [Organization].[Division].currentmember ),
IIF( STRTOSET(@InventoryType, CONSTRAINED).Count = 1, STRTOSET(@InventoryType, CONSTRAINED), [Inventory Type].[Inv Type].currentmember ) )
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
Any ideas? I've tried adding ordered sets to the query with no success. I've tried calculate measures in the cube with less success. My time dimension includes every day from 1/1/1980 to 12/31/2050.
The one calculated memeber i tried - AGGREGATE ([Date Shipped].[Date].[Date].Item(0):Tail(existing [Date Shipped].[Date].[Date]).Item(0)) took 20 minutes to run in VS Browser and produced an error for every date in the time dimension......
View 2 Replies
View Related
Apr 30, 2014
I have this script which pulls in all products from a product inventory with a sku range starting in 9 and ending in BK
select Product.ProductID,Product.Name,Product.SKU,ProductVariant.Inventory
From Product
Inner join ProductVariant
on Product.ProductID=ProductVariant.ProductID
where Product.SKU like '9%BK'
If I wanted to add something to this script where the inventory for all those products in the results above was changed from 0 to 20 how would I add this? Just changing those who had a a SKU starting with 9 and ending in BK
View 4 Replies
View Related
Jul 20, 2005
Hello, I'm looking for a little input on this situation.I'm working on an inventory system and was thinking that I'd like tobuild it similiar to the way a bank keeps track of your funds.If you look at at bank statement, for each line item, you'll normallysee at least date/time, description, amount (plus or minus value), andbalance.In my inventory system, the amount and balance would be a count of theitems used or transferred instead of money.Does this sound reasonable? Or is there a better design? I am planningto connect the inventory system to a few different ordering interfaces,and I think it would work well if I can dump transactions into theinventory instead of incrementing and decrementing counts.The only problem I see with this, is if I want to implement the balancepart of it with each record....I can't think of a way to do that currently.I can certainly use a trigger in the database to retrieve the mostrecent transaction and update the balance field for one record insertedat a time, but if a list of transactions is dumped into the inventorysystem at once, I'd have to compensate for that in the trigger.Ideas?*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 2 Replies
View Related
Jun 29, 2006
Hi,
I would like to know how does CMS stores content inventory in SQLserver.?
Example-If I create or migrate an application to CMS in sqlDB how does information is stored ?
Regards
T.Gunaseelan
View 4 Replies
View Related
Jun 17, 2008
Well probably not that complex for some of you out there!
I need to work out the amount of stock which was sold between @datefrom and @dateto and how much we currently have on hand (to work out if we are over ordering etc). That's the pretty easy part but I also need to include a column which works out how many items have been sold 3 months prior to @datefrom (from invoiceline). The proc I have so far works out the items sold between 2 dates so basically what I need is another column which is the amount sold (QtySold) in the 3 months prior to datefrom
This is the basic part I have so far:
ALTER PROCEDURE [dbo].[rptstockholdinglevel]
-- Add the parameters for the stored procedure here
@datefrom datetime,
@dateto datetime,
@periodname varchar(50),
@percentage int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT
products.productname,
@periodname AS periodname,
isnull(SUM(invoiceline.qty),0) AS QtySold,
products.qtyonhand AS OnHand,
nominals.nominalname,
productcategories.categoryname,
productmanufacturers.manufacturername
FROM
productmanufacturers RIGHT OUTER JOIN
invoices INNER JOIN
invoiceline ON invoices.invoiceid = invoiceline.invoiceid RIGHT OUTER JOIN
products ON invoiceline.productid = products.productid ON productmanufacturers.manufacturerid = products.manufacturerid LEFT OUTER JOIN
nominals INNER JOIN
productcategories ON nominals.nominalid = productcategories.salesnominal ON products.categoryid = productcategories.productcategoryid
WHERE
(invoices.invoicedate BETWEEN @datefrom AND @dateto)
OR
(invoices.invoicedate is null)
GROUP BY
products.productname,
products.qtyonhand,
productcategories.categoryname,
nominals.nominalname,
productmanufacturers.manufacturername
HAVING (SUM(isnull(invoiceline.qty,0)) < products.qtyonhand)
ORDER BY
nominals.nominalname,
productcategories.categoryname,
productmanufacturers.manufacturername
END
I'd be really grateful for any pointers as I'm just going round in circles on this one.
Thanks in advance as usual all :)
Stephen.
View 6 Replies
View Related
May 7, 2007
hello,I have a table like this:thing, size, color, type_mov, vary1, s, red, sell, 11, s, red, buy, 21, m, green, return, 10....and the question is how I can see the total number of products by sizeand color having in mind that some type of movement are + and otherare -.in other words, like stock control.how I can control this in sql server?code, procedures?thanks!
View 2 Replies
View Related
Dec 24, 2014
I have to caculate the fifo inventory aging from purchase date, for example I have one item with 100 units in stock, and purchase this month 20 units, and 200 units three month ago, this item has 20 units this month and 80 units from 3 month ago.
Data is as follows:
<<<<< ORIGINAL DATA >>>>>>>>>>>>>>>>
Code:
Code StockPO Date PO_Qty
ao0-123100OC001010-08-2014 8
ao0-123100OC001110-08-2014 4
ao0-123100OC002011-10-2014 50
ao0-123100OC002111-10-2014 2
ao0-123100OC002211-10-2014 20
ao0-123100OC003012-11-2014 10
ao0-123100OC003112-11-2014 1
ao0-123100OC003212-11-2014 20
And the reuslt must be something like this:
<<<<< ORIGINAL DATA >>>>>>>>>>>>>>>> <<<<< CALCULATED DATA >>>>>>
Code:
Code Stock PO Date PO_QtyDays_Old Qty_From_PO Residue
ao0-123100OC001010-08-2014 8 135 8 92
ao0-123100OC001110-08-2014 4 135 4 88
ao0-123100OC002011-10-2014 50 73 50 38
ao0-123100OC002111-10-2014 2 73 2 36
ao0-123100OC002211-10-2014 20 73 20 16
ao0-123100OC003012-11-2014 10 41 10 6
ao0-123100OC003112-11-2014 1 41 1 5
ao0-123100OC003212-11-2014 20 41 5 0
I need to built a select to make this calculation, not using cursors, and build a view, only a basic select.
View 4 Replies
View Related
Jan 30, 2006
I am developing an inventory database in SQL Server. I realize there aremany commercial (as well as some non-commercial) inventory offerings, but myclient has specific requirements that would necessitate significantcustomization of any off-the-shelf application. In the end, we decided itwould be more feasible to build one to our specifications.What I am looking for are a list of best practices/recommendations for thearchitecture and modeling of an inventory database. This inventoryapplication will be for managing a wholesale products operation. It mustmanage purchase orders to the manufacturer of the products, sales invoicesfor the retail customers of the products, as well as manage product stocklevels in the warehouse. We will need a number of reports, including:1. What products are in stock.2. What products are on order from the manufacturer.3. What products are needed to fulfill outstanding sales.4. Warehouse operations (e.g., receipt of delivery, inspection, add toinventory, pull from inventory, packing lists, invoices, return toinventory, etc.)5. Sales analysis (e.g., product velocity, sales by associate, etc.)My main question is regarding the managing of products in stock. As I see itthere are three ways of accomplishing this:1. Track only transactions (products received, products shipped, etc.) andcalculate the stock based on the sum of all transactions. But as transactionvolume accumulates over time, this would get very slow and cumbersome.2. Have a table of "units in stock" and add and subtract to it astransactions occur. This has the advantage of always providing an instantsnapshot of inventory levels. But it makes it more difficult to managechanges or corrections to a transaction once it has been entered.3. A combination of the above two concepts. Choose a point in time (forexample, when the warehouse inventory is audited) and capture that in a(semi) "static" table. After that, transactions are summed as needed againstthose static numbers. The next time the warehouse is audited, the "static"table is updated and all prior transactions are archived. New transactionsare once again summed against the most recent audit numbers. Of course, thiswould mean halting operations at the time of the audit (probably not anissue for my client's business).Recommendations? Suggestions? Comments?(Btw, I've tried to find this info in books and online, but so far have notfound anything that makes specific inventory system design recommendations.If you know of a good reference, please let me know.)Thanks in advance!Michael
View 4 Replies
View Related
Feb 22, 2008
What is a good simple way to scan the servers in your network for SQLServers?Does anyone have any scripts or code that would show me how to dothis?I think WMI might be able to do this but don't know where to start.If possible I'd like to be able to get the version (2000 or 2005) ifpossible.Thanks,Kelly GreerJoin Bytes!change nospam to yahoo
View 1 Replies
View Related
Apr 30, 2015
I would like to know how I could code so that I can get the ending inventory of each day. The following is my data
CREATE TABLE #TEMP
(
DATERCVD DATETIME
,ACCTID INT
,DATESENT DATETIME
)
INSERT INTO #TEMP VALUES ('01/01/2015', 1 , '01/05/2015')
[Code] ....
So my query results should be something like this:
InventoryDate Received Sent Ending
1/1/2015 4 1 3
1/2/2015 5 0 8
1/3/2015 3 2 9
1/4/2015 0 4 5
1/5/2015 0 5 0
TOTAL 12 12
View 5 Replies
View Related
Sep 3, 2007
helo alll...,this is my data:my table is item(productid,stock) ,order(customerid,no_order), and orderdetail (no_order,productid,quantity) example: order and orderdetail displayed in gridview....order is displayed like this: customerid no_orderdetail A 1detail B 2 when i click detail in row 2, it's display orderdetail:no_order productid quantity 2 c1 2 2 p1 3 i have make all this is ok. but i want to decrease stok in item with quantity in orderdetail.my code in procedure like:CREATE PROCEDURE [dbo].[order_item](@productid AS varchar,@quantity AS INT)ASBEGINBEGIN TRANSACTIONDECLARE @no_order AS INTDECLARE @stock AS INTINSERT INTO [Orderdetail]([ProductId],[Quantity])VALUES(@productId,@quantity)SET @no_order = SCOPE_IDENTITY()SET @Stock = (SELECT [Stock] FROM [item] WHERE [ProductId] = @productId)UPDATE [item]SET[Stock] = @Stock - @quantityWHERE[ProductId] = @productIdCOMMIT TRANSACTIONENDreturn it can't work..how about his true code in store procedure?ok..., thx..
View 8 Replies
View Related
Oct 8, 2015
I have the following store procedure :
SELECT APHIST.ReturnDate AS ATDATE
,API_HIST.[ActionPlanItemID]
,API_HIST.[ActionPlanID]
,PIT.[ProductItemID]
,PIT.ProductItemCode
,PIT.Name,
[code]....
What I am trying to get is a RunningStock level column which is able to display stock level as describe below :
If ItemStatus value is 0, that means that the item has been taken out from stock.
So based on that the first row running Stock level is calclulated as
(ProductQuantity * ItemUnitWeight)-ItemQuantity=9...
For the second record, ItemsStatus=1 which means the item return to stock, at the time the running stock value calculation should be the previous row Running Stok value (=9 ) +(ItemQuantity*ItemUnitWeight)When the ItemStatus=2, that means the item is definitely out and will be never back to current stock. Is there a way to get that calculation field ?
View 6 Replies
View Related
Mar 13, 2007
I would like to use analysis services to analyze stock prices.
I want to find conditional probabilities:
P (YpriceChg >= 10% s.t. Ydate between A and B| X Price Chg >= 20%)?
€¦ Like given a price change of X percent or greater, predict the probability of a price change of Y percent or greater, within a specified time window (like 2 days, 3 months etc.).
I also want to add a support filter, like:
N > 30 cases (i.e., there have been at least 10 instances of a 10% or greater price change, for the chosen time window)
I have a database of prices, monthly, daily, etc. I also have a number of cols that compute statistics such as pChg1M, pChg-1M, vChg1d. Like price chg 1 month forward, price change 1 month backward, volumeChg1d forward. Ideally, I would like to minimize the column flags necessary for the experiment. Can you offer some hints, as far as setting up appropriate columns/flags and choosing a algorithm (maybe decision trees, association rules, or NB)?
View 1 Replies
View Related
Apr 21, 2006
I have stock data in 1 min intervals and would like to convert it into other timeframes (e.g., 10 min, daily, monthly).
Here's is some sample data and my final goal:
[DateTime] [Open] [High] [Low] [Close] [Volume]
10-Feb-05 12:10:00 3.88 3.88 3.87 3.87 10
10-Feb-05 12:11:00 3.87 3.87 3.87 3.87 2
10-Feb-05 12:12:00 3.86 3.86 3.86 3.86 1
10-Feb-05 12:13:00 3.85 3.87 3.84 3.85 23
10-Feb-05 12:14:00 3.85 3.85 3.85 3.85 6
10-Feb-05 12:15:00 3.86 3.86 3.86 3.86 1
10-Feb-05 12:16:00 3.85 3.85 3.85 3.85 1
10-Feb-05 12:18:00 3.85 3.85 3.85 3.85 3
10-Feb-05 12:19:00 3.85 3.85 3.85 3.85 3
[DateTime] [Open] [High] [Low] [Close] [Volume]
10-Feb-05 12:10:00 3.88 3.88 3.84 3.85 50 *
*sum
View 8 Replies
View Related
Feb 9, 2008
Hello
I would appreciate If any one could help me in this matter.
problem is : how to maintain perpetual inventory transaction table order in batch mode updation ?.
I have designed a table to hold all inventory transactions. The table order is perfectly maintained in online system of updation. But if I go with batch updation then the order of the transaction is collapsing. For example consider the following table design. (note I used auto number to maintain the order).
version used : SQL Server 2000 with service pack updates.
LINEID TRANS_TYPE TRANS_ID TRAN_DATE STOCKNO QUANTITY RATE
1 Receipts 2 01/01/2000 xxxxx1 2 2.0
2. Issue 1 01/01/2000 yyyyy1 1
3 Receipts 3 02/01/2000 xxxxx2 4 3.0
4 Issue 2 02/01/2000 yyyyy2 1
the above is well in online mode. But in batch mode if i update issue 2 before receipts 3 then i am getting order like below
1 Receipts 2 01/01/2000 xxxxx1 2 2.0
2. Issue 1 01/01/2000 yyyyy1 1
3 Issue 2 02/01/2000 yyyyy2 1
4 Receipts 3 02/01/2000 xxxxx2 4 3.0
ofcourse if the order collapse means costing can not be accurate. so please any one could help me to solve this problem. because many software packages are not posting in sequence if we choose in batch mode.
View 5 Replies
View Related
Aug 7, 2014
So I have been struggling with a way to perform inventory turn calculations in SQL. I'll start off with the formula. Basically the formula is Cost of Goods Sold over last 12 months / Average Inventory Value over the last 12 months. Short hand as COGS/AvgInventoryValue = Turns
In order to obtain the COGS value I take the Avg(UnitCost) * Sum(InvoicedQty) in the last 12 Months for Sales documents. This is represented as DOCUMENTTYPE = 2
Then divide AvgInventoryValue
To obtain the AvgInventoryValue I need to know the Quantity purchased in the 12 month period * Avg(UnitCost) + QuantityOnHand at the start of the period * Avg(UnitCost)
The purchased documents are represented with DOCUMENTTYPE = 6
The purchases will be positive since we are putting value in. The sales are negative since value is going out. I'll start with a simple example where the product is at zero Quantity On Hand at the beginning of the period.
--CREAT THE TEMP TABLE
create table #VALUEENTRY
(
ITEMNO VARCHAR (50) NOT NULL
, POSTINGDATEDATETIME NOT NULL
, DOCUMENTTYPEINT NOT NULL
[code]....
Is there another approach I should take to obtain the inventory turns?Also how do I account for periods earlier than 12 months where inventory is left over?In the sample data this item happened to be at zero inventory on hand at the start of the period. Also I believe it is my subquery's which are throwing the numbers off but I'm not sure how to isolate the subquery to just perform the result for a specific item. It is aggregating the entire table. How can I make the subquery more specific?
View 3 Replies
View Related
Oct 23, 2006
Hi everyone,
I am a novice programmer. I want to develop a Inventory software using
C# 2005, which will run on a LAN environment. There will be three machine
which will store and retrive data from a common database. Which version
of SQL server is appropiate for this ? Is it possible to provide the
networking facilily using MS Access ? I don't know how to configure SQL
Server for this. Please help me.
Thank You.
View 4 Replies
View Related
May 8, 2015
how to measure a change in inventory over various stores. Â My sql2008R2 express db gets a new row of data everyday from each store(about 40 stores) for a single product stock count "OnHand" and if there is any new stock on order. Â When the new stock arrives it is added to the "OnHand" count. Â I want to measure the delta change per day,per store. Â I'm stuck on how to separate the stores and how to query the delta of stock.My data base looks like this
               Â
TimeStamp Store
OnHand OnOrder
2015/04/22 18 Â Â 1 - Concord
12
   0
2015/04/23 11 Â Â 1 - Concord
11
Â
[code]....
View 17 Replies
View Related
Oct 3, 2015
To setup some data in some new tables in t-sql 2012, I need to create a relationship between 2 tables were data is obtained from an inventory file. The inventory file will be loaded to sql server 2012 from an excel spreadsheet.
1. Columns that will be loaded to the first table are:
1. Inventory category number,
2. Inventory date,
3. Inventory Category total amount, and
4. Inventory category quantity on hand.
This table will have a column called Item number. This will need to be the value of item number that is in the second table.
2. Columns that will be loaded to the second table are:
1. Item Number,
2. item date,
3. Item price, Item quantity on hand.
Thus can you show me the sql that will load the table into both tables? This sql would also need to show how to obtain the values of item number from the second table and place that value into the first table.
View 4 Replies
View Related
Sep 15, 2015
We have an application where we want to check to see if the vehicle part on a job matches to our internal parts inventory (PartsInventory table) before we order it. The problem is that sometimes the part number matches exactly and sometimes the part number has '-' or space but if those are removed, will match to our internal part number. Below is what I have so far but it only matches exact part numbers. One example would be if our part number was 1013738-00-C but the job (in RepairOrderLines) had a part number of 101373800C we should consider it a match. Both PartNumbers are varchar(30).Â
SELECT dbo.PartsInventory.PartNumber, dbo.PartsInventory.PartDescription, dbo.PartsInventory.VehicleMake
FROM dbo.PartsInventory INNER JOIN
dbo.RepairOrderLines ON dbo.PartsInventory.PartNumber = dbo.RepairOrderLines.PartNumber INNER JOIN
dbo.RepairOrder ON dbo.RepairOrderLines.RecordID = dbo.RepairOrder.RecordID INNER JOIN
dbo.Vehicles ON dbo.RepairOrder.VehicleID = dbo.Vehicles.VehicleID AND dbo.PartsInventory.VehicleMake = dbo.Vehicles.VehicleMake
WHERE (dbo.RepairOrderLines.RecordID = 46001)
View 3 Replies
View Related
Oct 4, 2007
hi allin the sample of sqlserver2005(notification service(stock))this is code sample in :appADF.xml(stock) -------------------------- -- Update value in the chronicle if event price greater than value in the chronicle UPDATE StockEventsChron SET StockPrice = E.StockPrice FROM StockEvents E, StockEventsChron C WHERE E.StockSymbol = C.StockSymbol AND E.StockPrice > C.StockPrice.for scenario: + the first SubscriberId(Stephanie) set :StockTriggerValue=20, and stockPrice changge =50 -> one notification for Stephanie and in the table StockEventsChron the value field :StockPrice = 50, + the next : stockPrice changge = 25. the field value StockPrice of table StockEventsChron is still 50 + then second SubscriberId(Scott) set StockTriggerValue=30 but---------------- Insert Into StockNotifications ( S.SubscriberId, S.DeviceName, S.SubscriberLocale, E.StockSymbol, E.StockPrice ) SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale, E.StockSymbol, E.StockPrice FROM StockSubscriptions S JOIN StockEvents E ON S.StockSymbol = E.StockSymbol LEFT OUTER JOIN StockEventsChron c ON S.StockSymbol = c.StockSymbol WHERE S.StockTriggerValue <= E.StockPrice AND (S.StockTriggerValue > c.StockPrice OR c.StockPrice IS NULL) here :StockTriggerValue=30 < c.StockPrice=50 so no notification for Scott, why ?can anyone help me?
View 1 Replies
View Related
Jan 9, 2001
Okay, here's an algorithm question for you TSQL gurus out there...
Due to circumstances beyond our control, our group has been tasked with a massive project and a very short timeline. And of course, timely completion is needed because our STOCK OPTIONS grants depend on this! And of course board meetings are always scheduled sooner than you expect.
Here's one of the killer questions we're trying to solve...
Given a table of employee ID's, associated supervisor ID's, and the amount of stock options given, how would you write a stored procedure to return, for any branch of the organizational tree, the sum of all the stock options in a particular branch?
Example:
EMPID SUPERVISORID STOCKOPTIONS
1 2 100
2 30 500
3 2 150
30 50 1000
50 60 5000
What we need is something like : "sp_StockOptionsPerDepartment @SUPERVISORID=30"
with a result : "1750".
Basically we're building an organizational chart of our company from this table, on the fly, and also counting up for certain branches of the org chart, the total stock options.
If a manager has two managers under him, and each sub-manager has three employees, then we want to know the total stock options that all 3+3+2+1 = 9 people possess. Basically it's the total pool of stock options for a department, or work group, or division, etc.
Got this to work for a small set of employees, but when we begin to scale up to entire departments, the query times out because it takes tooooo long...
Any ideas? ANY ideas at ALL would be helpful...
Comments
(1) This is basically a tree-traversal algorithm, but conversion into SQL is not always so straightforward. Starting from an arbitrary root node, we must visit every child node underneath, walking all the way down to the leaves.
(2) We tried a brute force algorithm which is fast for smaller sets, but impossibly long for sets where we're dealing with hundreds of employees. Any cheats? Caching results as we go? Any ideas out there?
Thanks,
Dan
dantan@pobox.com
View 6 Replies
View Related
Dec 30, 2011
Assume you have a table called Tick with 2 columns
(
tickId bigint IDENTITY(1,1)
, price int -- usually money data type, making it int for simplicity
)
I am tasked with creating bars that are 10 units long.
Now the catch is I'm not looking for the tickId where price is >= t1(price) + 10 where t1(price) is the price for the first row where tickId = 1. (it could also be where price <= t1(price) - 10)
Here is sample data:
1, 25
2, 26
3, 23
4, 26
5, 27
6, 30
7, 34
8, 32
9, 30
10, 33
What I am looking for are rows 3 (23) and 7 (34)
Currently I have:
Code:
DECLARE @tickDiff int
SET @tickDiff = 10
DECLARE @r1TickId bigint
[Code].....
This seems to work but it is taking multiple minutes to run for about 50k rows of data (which I created off of the 24 million row table I have just looking at data from today). So it takes ~5 minutes to create the first bar which is not acceptible.
If my logic above seems acceptable are there any indexes you could recommend. Database engine tuning advisor didn't find any.
View 2 Replies
View Related
Dec 11, 2014
I have been asked to report on missing Stock in my works Warehouses. My work uses SAP Business One for ERP, and Accellos for Warehouse Management. Both SAP / Accellos maintain stock levels, and whilst they do talk to each other (in real time), nothing is perfect and stock counts (within each system) sometimes develop discrepancies.
Here is the code that I developed to show stock discrepancies -
Code:
SELECT
Tx.[Item Code]
, ISNULL(Ty.Qty, 0) AS 'A1 Qty'
[Code]....
View 1 Replies
View Related
Sep 10, 2014
I need to create query for last stock quantity.
I have 3 tables. Stores, Dates and Transactions. I want to combine all Stores with all Dates in one table and then calculate Last Stock Quantity.
Stores
London
Paris
Prague
Dates
1.1.2014
2.1.2014
3.1.2014
Transactions
1.1.2014 London 1000
1.1.2014 Paris 1300
1.1.2014 Prague 1500
2.1.2014 London 800
3.1.2014 Prague 1200
And result should look like this Last_Quantity should be Quantity for last date in Transactions table.
1.1.2014 London 1000
1.1.2014 Paris 1300
1.1.2014 Prague 1500
2.1.2014 London 800
2.1.2014 Paris 1300
2.1.2014 Prague 1500
3.1.2014 London 800
3.1.2014 Paris 1300
3.1.2014 Prague 1200
View 8 Replies
View Related
Oct 23, 2015
I am struggling with the Lastdate function. I have got stock balance data and want to show the number of products/models that are on stock at the latest date of the stock balance table.
My DAX formula is as follows:
=CALCULATE(DISTINCTCOUNT('3S-StockData'[Article Model]);LASTDATE('3S-StockData'[Date]))
I get the wanted results for all aggregated product groups, on product/model level however the formula does not give me the information wanted (see screenshot).
Basically, the formula calculates correct, but I want in my example only models shown with the date 2015-10-21.
View 2 Replies
View Related
Mar 8, 2008
Hi,
My tables:
Product
- productID
- name
- price
Inventory
- productID
- stockCount
- timestamp
So each day the Inventory table has a new row for each productID with its stock count.
How can I create a report for the total products sold from one day to another? Or from what a dateStart from a dateEnd (i.e. a range)
Example:
ProductID StockCount TimeStamp
1 10 2008/03/07
1 7 2008/03/08
So you can see that 3 products were sold in the last day.
View 4 Replies
View Related