Untitled

mail@pastecode.io avatar
unknown
sql
3 years ago
732 B
1
Indexable
Never
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================

-- =============================================
CREATE PROCEDURE   Stok_GünSonu_SP2

AS
BEGIN
delete Stok_GünSonu where DATE = CONVERT(DATE,GETDATE(),104)




INSERT INTO Stok_GünSonu  ([RENKKODU], [RENGI], [ADET], [Expr2], [STOSIRA], [STOTANiM], [STOGRUPSIRA], [STOKOD2], [DATE])
SELECT     RENKKODU, RENGI, ADET, SUM(KG) AS Expr2, STOSIRA, STOTANiM,STOGRUPSIRA,NUMARA , GETDATE()
FROM        YAREN_IPLIK.dbo.view_ambardurum_yeni
WHERE    (STOSIRA > 0) AND ADET>0
GROUP BY RENKKODU, RENGI, STOSIRA, STOTANiM,STOGRUPSIRA,NUMARA,ADET 
ORDER BY STOSIRA, RENKKODU,RENGI,NUMARA 

	SET NOCOUNT ON;
	
END
GO