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.
Author |
Topic |
nikoz
Yak Posting Veteran
63 Posts |
Posted - 2013-12-16 : 08:41:42
|
How to make procedure to calculate data between month ?I have this but i don't know what to do with that :( between dbo.fPA_FirstDayOfTheMonth(dateAdd(month, -1, dbo.fPA_RemovingTime(getDate()))) and dbo.fPA_LastDayOfTheMonth(dateAdd(month, -1, dbo.fPA_RemovingTime(getDate()))) |
|
djj55
Constraint Violating Yak Guru
352 Posts |
Posted - 2013-12-16 : 08:54:02
|
[code]SELECT * FROM MyTable WHERE MyDate BETWEEN DATEADD(month,DATEDIFF(month, 0,GETDATE()),0) AND DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))[/code]Analyze this code and maybe that will help you.djj |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
ScottPletcher
Aged Yak Warrior
550 Posts |
Posted - 2013-12-16 : 12:14:15
|
[code]WHERE date_column >= DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) - 1, 0) AND date_column < DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0)[/code] |
|
|
|
|
|
|
|