Jump to content

Recommended Posts

Posted

pls help sql server oka query undi 

 

select p.ID,  g.ID, g.Name

from Person p

join Group g on g.Name = 'Members' 

join Sub s on s.subid = p.LinkID and s.orderID = 3

join Suborder so on so.subid = s.id

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

 

 

I am trying to change a subscription period where startdate is -3 months and  enddate is +2 months from the subscription time  but  error vasthundi 

 

Adding a value to a 'datetime' column caused an overflow.

 

what mistake am i doing ?  pls help. 

 

as it is ala cheyyocha sql server lo???

 

syntax error emo?

  • 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

agree.. but we dont know what exactly the table is used for at ..only sqlhelp would know.. for now to get the query into working state i told the solution

 

table yearly subscription order info pull chesthundi .. but 2999 yr ki change chesthe enduku help avthundi ?

 

is it becuase 9999 is max yr? 

Posted

as it is ala cheyyocha sql server lo???

 

syntax error emo?

 

can can man... but cross join ala avadaniki scopes untaayi if your joins are not good... fdi4g.gif

Posted

table yearly subscription order info pull chesthundi .. but 2999 yr ki change chesthe enduku help avthundi ?

 

is it becuase 9999 is max yr? 

 

yes 9999 is max limit for any date time column man... you are trying to add more values there...fdi4g.gif

Posted

yes 9999 is max limit for any date time column man... you are trying to add more values there...fdi4g.gif

 

 

thank you boss

Posted

table yearly subscription order info pull chesthundi .. but 2999 yr ki change chesthe enduku help avthundi ?

 

is it becuase 9999 is max yr? 

 

exactly... ur trying to add more than what it can hold

Posted

use this man....

 

select p.ID,  g.ID, g.Name
from Person p
join [Group] g on g.Name = 'Members' 
join Sub s on s.subid = p.LinkID and s.orderID = 3
join Suborder so on so.subid = s.id
where cast(getdate() as date) between (dateadd(month,-3,so.StartDate)) 
and CASE WHEN so.EndDate = '12/31/9999' THEN so.EndDate
ELSE (dateadd(month,2,so.EndDate)) END
 
fdi4g.gif
Posted

 

use this man....

 

select p.ID,  g.ID, g.Name
from Person p
join [Group] g on g.Name = 'Members' 
join Sub s on s.subid = p.LinkID and s.orderID = 3
join Suborder so on so.subid = s.id
where cast(getdate() as date) between (dateadd(month,-3,so.StartDate)) 
and CASE WHEN so.EndDate = '12/31/9999' THEN so.EndDate
ELSE (dateadd(month,2,so.EndDate)) END
 
fdi4g.gif

 

Thankyou

Posted

did it help you man... fdi4g.gif

 

yes man it did 

2999 ki update cheyamanaru and thy liked the idea to update our max dates instead 9999 

Posted

yes man it did 

2999 ki update cheyamanaru and thy liked the idea to update our max dates instead 9999 

 

Glad it worked for you man... Enjoy man..fdi4g.gif

×
×
  • Create New...