By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,265 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,265 IT Pros & Developers. It's quick & easy.

sql query out of range datetime value

P: 11
create proc getproviders
select ProviderType,ProviderTypeId,ProviderName,City,Stat e,Country,
StagingName,providerCode,convert(varchar(10),Agree ment_enddate,101)Agreement_enddate from provider
join stagingMaster on
stagingMaster.StagingId = provider.StagingId
where isDate(Agreement_enddate) = 1 and convert(datetime,Agreement_enddate,101) <= getdate() and logicallyDeletedFlag=0

iam getting the following error can any one suggest

Msg 242, Level 16, State 3, Procedure GetExpiredProviders, Line 4
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

thanks & regards
Sep 9 '08 #1
Share this Question
Share on Google+
2 Replies

code green
Expert 100+
P: 1,726
Not sure where the error is but I think it is this line
Expand|Select|Wrap|Line Numbers
  1. convert(datetime,Agreement_enddate,101)
Test by removing that line.
I can't see why you are converting to a datetime.
Surely it already exists as such.
To remove any ambiguity rename the alias 'Agreement_enddate' to something else.
Sep 9 '08 #2

Expert 2.5K+
P: 2,878
What's the data type of this column: Agreement_enddate

-- CK
Sep 9 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.