Jump to content

Recommended Posts

Posted

 

where cast(getdate() as date) between (dateadd(mm,-3,so.StartDate)) and (dateadd(mm,2,so.EndDate) )

 

Tyr cheyi

 

 

 

Use Month instead of mm

 

SELECT * FROM MyTable
WHERE MyDate < DATEADD(month, -2, GETDATE())

  • Replies 56
  • Created
  • Last Reply

Top Posters In This Topic

  • sqlhelp

    16

  • loveindia

    16

  • ceelogreen

    13

  • dotnetrockz

    4

Popular Days

Top Posters In This Topic

Posted

are u getting results when u hardcod the date like '11/1/2014' and 1/1/12015?

 

yes resulsts vasthunayi its just dateadd petinapudu error avthundi 

Posted

Use Month instead of mm

 

SELECT * FROM MyTable
WHERE MyDate < DATEADD(month, -2, GETDATE())

 

what is the difference man??? fdi4g.gif

Posted

i think the issue, start date or end date is out of range for that table after the addition of -2 months... fdi4g.gif

Posted

check ur table data...first sometimes end date column ni max time ki default ga insertc hestharu so if ur trying to increment that by 2 months overflow vasthundhi.....for this u can filter by adding a condition tow here clause

 

actually u are right end date is set to a default value  

 

em condition ? 

Posted
DECLARE @Date DATETIME
 
SELECT @Date = '01/01/1753'
 
SELECT DATEADD(D, -1, @Date)

This might be the error man... fdi4g.gif

Posted

select max(so.EndDate),min(endDate)

 

results  veyi  ba

 

startdate 1/1/2015 

enddate 12/31/2015

Posted
DECLARE @Date DATETIME
 
SELECT @Date = '01/01/1753'
 
SELECT DATEADD(D, -1, @Date)

This might be the error man... fdi4g.gif

 

 

declare add cheymantunava  in my select query ? 

Posted

startdate 1/1/2015 

enddate 12/31/2015

if these are the dates in ur table then the query shouldnot throw that error

Posted

startdate 1/1/2015 

enddate 12/31/2015

 

Max(ENDDATE),Min(ENDDATE)

Posted

declare add cheymantunava  in my select query ? 

 

no man... when you ran the max and min on the start and end dates did you get only 2015 year??? fdi4g.gif

Posted

if these are the dates in ur table then the query shouldnot throw that error

 

right...

×
×
  • Create New...