Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8812763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:40:43+00:00 2026-06-14T03:40:43+00:00

I have searched about 20 results apertaining to the error message Conversion failed when

  • 0

I have searched about 20 results apertaining to the error message “Conversion failed when converting date and/or time from character string.” and none seem to address my issue.

A little history, last Friday the queries were working just fine and the data returned was proper. On the following Monday, the queries no longer worked and gave this error message, “Conversion failed when converting date and/or time from character string.” So, after a few hours of battling it was able to run a function with the offending code in it and the query ran perfect again. Until this morning. I came into the office and ran the query and received the error “Conversion failed when converting date and/or time from character string.” So now I am pulling my hair out.

I started by verifying each record being returned is, in fact, a valid date using the isDate function. All the dates are valid dates in string format. I am simply doing a check to see whether or not the record is older than 1 year.

I do have several INNER JOINS and have been wondering if they are affecting the output.

SELECT 
gc2p.partnumber, gc2p.orderby, gc2p.campaigncode, gp2a.assetfilename
FROM [StepMirror].[dbo].[stepview_nwppck_ngn_getclassification2productrefs] gc2p
,[StepMirror].[dbo].[stepview_nwppck_ngn_getpimweblegalattrlist1] gpwa
,[StepMirror].[dbo].[stepview_nwppck_ngn_getclassification2assetrefs] gc2a 
,[StepMirror].[dbo].[stepview_nwppck_ngn_getproduct2assetrefs] gp2a 
WHERE gc2p.partnumber=gpwa.PARTNUMBER and
gc2p.id=gc2a.id and
gp2a.PRODUCTNAME=gpwa.PARTNUMBER and
ATTRIBUTENAME='New Date' AND 
ATTRIBUTEVALUE > dateadd(month,-12,getdate()) AND 
gc2p.id = '5665976' and 
gc2a.assettype='Primary Image' AND 
gp2a.ASSETTYPE = 'Primary Image'
order by gc2p.orderby

If anyone could give me a helping hand that would be wonderful.

Edit: The query runs fine when I remove ‘ATTRIBUTEVALUE > dateadd(month,-12,getdate())’. I forgot to mention the exact part of the query throwing the error.

Edit: Updated Query – Now Working Query for those seeking a similar answer.

SELECT TOP 18 gc2p.partnumber, gpwa.ATTRIBUTECNAME,gp2a.ASSETFILENAME, gpwa.ATTRIBUTEVALUE
FROM [StepMirror].[dbo].[stepview_nwppck_ngn_getclassification2productrefs] gc2p
INNER JOIN [StepMirror].[dbo].[stepview_nwppck_ngn_getpimweblegalattrlist1] gpwa ON gc2p.partnumber=gpwa.PARTNUMBER and gpwa.ORDERBY='96'
INNER JOIN [StepMirror].[dbo].[stepview_nwppck_ngn_getclassification2assetrefs] gc2a ON gc2p.id=gc2a.id
INNER JOIN [StepMirror].[dbo].[stepview_nwppck_ngn_getproduct2assetrefs] gp2a ON gc2p.partnumber=gp2a.PRODUCTNAME
WHERE gc2p.id = 5665976 AND gp2a.assettype='Primary Image' AND gc2a.assettype='Primary Image' 
AND(CASE WHEN ISDATE(ATTRIBUTEVALUE)  = 0 then NULL ELSE ATTRIBUTEVALUE END) > dateadd(month,-12,getdate())
order by gc2p.orderby
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:40:44+00:00Added an answer on June 14, 2026 at 3:40 am

    The issue is likely that you have non-date data in the ATTRIBUTEVALUE field. You’re assuming that including the ATTRIBUTENAME='New Date' will filter it, but it may not depending upon the query plan. Try…

    (CASE WHEN ISDATE(ATTRIBUTEVALUE) = 0 then NULL ELSE ATTRIBUTEVALUE END) > dateadd(month,-12,getdate()) AND ...
    

    In complex joins, the SQL engine may decide to join the tables first then use the filter, which will cause a mismatch is not every instance of ATTRIBUTEVALUE will convert implicitly to a date.

    Also, please use real SQL joins, not comma joins. It’s bad form and causes way more problems than it solves.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've searched Google about this specific exception and multiple results have surfaced but I
I have searched a lot about the difference between Website and WebApplication but didn't
I have searched on google about how to get started with the dependency property
I have searched for a CGI and read about it but nothing useful found.
So I have searched for this but not finding anything about it and if
I have googled a lot and also searched in stackoverflow.com about how to sort
I have searched many a page of Google results as well as here on
I have searched on this and found something about using remotely hosted JSPs but
I have searched the Internet and found out some information about video-conference streaming, and
ok, i have searched for this in the past two hours with results that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.