Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2010

    Unanswered: Day before the date parameters entered


    MS SQL 2005 I'm trying to write a stored procedure.Weighted average cost related to accounting.An area where the data from one field if the date is 01.01. There is no problem. But history is different from 01/01 with the calculated formula into another value equal to the previous day.If you want Let me demonstrate:
    IF @BasTarih ='01.01.2010'
    SELECT @BasEnvanter = Sum(Tutar) FROM StokHareket WHERE Stok=@Stok
    SELECT @BasEnvanter = @BitEnvanter WHERE Day(@BasTarih-1)

    Here, the amount collected in the first line I was on the date 01/01. But the day before the field is not BitEnvanter that bring value as I was. But here a formula that BitEnvanter area. That is not the first time BitEnvanteri calculated 01.01 and then got BasEnvantere synchronization.I think this, but let me run. I make a mistake in formulas or algorithms, I wonder do wrong?


  2. #2
    Join Date
    Jan 2003
    Provided Answers: 17
    You would want dateadd, rather than day. Also, you would want to compare that to something.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts