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 2005 Forums
 Transact-SQL (2005)
 stored procedure

Author  Topic 

vijayanto
Starting Member

16 Posts

Posted - 2009-06-01 : 07:56:19
hi friends,
i did stored procedure in the sql server while i got the problem
i want to get quantity for previous date
the query is following below;
SELECT DATEADD(year, - 1, T0.DocDate) AS Expr1, T0.DocDate, T0.CardCode, T0.CardName, T1.ItemCode, T1.Dscription, T1.Quantity
FROM OINV AS T0 INNER JOIN
INV1 AS T1 ON T0.DocEntry = T1.DocEntry

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-01 : 08:05:06
WHERE t0.docdate >= datediff(day, 1, getdate()) and t0.docdate < datediff(day, 0, getdate())



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SQLRatankalwa
Starting Member

42 Posts

Posted - 2009-06-01 : 11:14:26
SELECT DATEADD(year, - 1, T0.DocDate) AS Expr1, T0.DocDate, T0.CardCode, T0.CardName, T1.ItemCode, T1.Dscription, T1.Quantity
FROM OINV AS T0 INNER JOIN
INV1 AS T1 ON T0.DocEntry = T1.DocEntry
Where T0.DocDate Between GetDate() - 1 and GetDate() + 1

Revalsys Technologies Private Limited
http://www.revalsys.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-01 : 13:42:47
quote:
Originally posted by SQLRatankalwa

SELECT DATEADD(year, - 1, T0.DocDate) AS Expr1, T0.DocDate, T0.CardCode, T0.CardName, T1.ItemCode, T1.Dscription, T1.Quantity
FROM OINV AS T0 INNER JOIN
INV1 AS T1 ON T0.DocEntry = T1.DocEntry
Where T0.DocDate Between GetDate() - 1 and GetDate() + 1

Revalsys Technologies Private Limited
http://www.revalsys.com


this will all data from previous day current time till next day current time which was not OP asked for
Go to Top of Page
   

- Advertisement -