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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 FIFO METHOD

Author  Topic 

DENIZ3E
Yak Posting Veteran

56 Posts

Posted - 2005-12-10 : 15:45:24
--GIRIS=IN
--CIKIS=OUT


DECLARE @GIRIS TABLE (LOGICALREF INT,IOCODE INT,DATE_ DATETIME,STOCKREF INT,AMOUNT FLOAT,PRICE FLOAT,TRCURR SMALLINT ,EUR FLOAT,UOMREF INT,UINFO8 INT)

DECLARE @CIKIS TABLE (LOGICALREF INT,IOCODE INT,DATE_ DATETIME,STOCKREF INT,AMOUNT FLOAT,PRICE FLOAT,TRCURR SMALLINT ,EUR FLOAT,UOMREF INT,UINFO8 INT)

INSERT @GIRIS VALUES(28,1,'12.10.2005',4,10,3,20,2,23,0)
INSERT @GIRIS VALUES(36,1,'12.11.2005',4,4,4,20,3,23,0)
INSERT @GIRIS VALUES(38,1,'12.12.2005',4,8,5,20,4,23,0)

INSERT @CIKIS VALUES(29,4,'12.13.2005',4,5,3,20,0,23,0)
INSERT @CIKIS VALUES(34,4,'12.14.2005',4,5,4,20,0,23,0)
INSERT @CIKIS VALUES(37,4,'12.15.2005',4,2,5,20,0,23,0)
INSERT @CIKIS VALUES(39,4,'12.16.2005',4,4,5,20,0,23,0)


---------------------------------------------------------------------


-------------------------------------------------------------------
I WANT TO FIFO METHOD... @stockref and @miktar are variable.
@GIRIS IS MY ENTERANCE table and @CIKIS IS MY EXIT TABLE.
I WANT TO PRICE MY SEILS BY FIFO LOGIC.

example:
For @stockref=4 and @amount=5...
1. First enterence is 2 eur for 10 meterails. 5 stocks that have been sold first are 2 eur. .....


I have asked this questions twice but I havent seen any answer.ý hve taken an answer but ý havent found the answer in the site that which I have been directed too. I m lookýng forward to take help from you.
...



bhill_32
Starting Member

1 Post

Posted - 2005-12-11 : 18:52:47
This appear to be simple.

1. Create indenity colume on your tables
2. Create a stored proc or function that returns the min of that col.

You can flag the row as delete, that way you don't have to remove you
data or you can have a trigger that fires that add the row to a history table and deletes the row from your queue.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-12-11 : 19:15:10
You haven't really explained what it is you are trying to do, or what problem you are having. You posted a couple of table definitions but you didn't explain the meaning of the data.

Do you expect that we will interview you to find out your requirements, or that we will be able to guess what you want? You will find people here that are willing to help if you show that you are willing to help yourself.




CODO ERGO SUM
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-12 : 01:17:26
See if this helps you
http://www.dbazine.com/ofinterest/oi-articles/celko32

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -