467,134 Members | 1,026 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,134 developers. It's quick & easy.

sql query out of range datetime value

create proc getproviders
as
begin
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
end

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
raam
Sep 9 '08 #1
  • viewed: 4257
Share:
2 Replies
code green
Expert 1GB
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
ck9663
Expert 2GB
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.

Similar topics

2 posts views Thread by Maksim Kasimov | last post: by
4 posts views Thread by Russell | last post: by
reply views Thread by Jim in Arizona | last post: by
2 posts views Thread by sixdeuce62 | last post: by
14 posts views Thread by Simon Gare | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.