Advertisement

02.12.2008 at 04:46AM PST, ID: 23155936
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.(#242)

Asked by suresh2000 in SQL Server 2005, Microsoft Access Database, Access Coding/Macros

Tags: , , , ,

I fetch data from SQL Sever 2005 through MS Access interface using SQL Pass-Through Queries (SPTQ). I have two queries with the same sql text inside (please see the code snippet) and connect to the same database, same tables; only the filter (A.CY_CYCLE Like %D-DC8-P%) is different.

When I fetch the data with filter A.CY_CYCLE Like %D-DC8-P% (newly available data in the table) MS Access does not throw any error message and all data is fetched successfully.

However when I fetch data with filter A.CY_CYCLE Like %D-DC5-P% (old data available in the table) MS Access throws error "ODBC--call failed.  [Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.(#242)"

On the SQL server TC_EXEC_DATE field is defined as datetime whereas B.TC_EXEC_TIME field is defined as VARCHAR(15).

I want to combine these two fields and get one datetime field.

Why the same sql text works fine where as it does not work for the other???

Any answers will be much appreciated.
Start Free Trial
1:
2:
SELECT A.CY_CYCLE_ID AS [TESTSET_ID], A.CY_CYCLE AS [TESTSET_NAME], A.CY_OPEN_DATE AS [TESTSET_CREATION_DT], B.TC_TEST_ID AS [TESTCASE_ID],  C.TS_NAME AS [TESTCASE_NAME], C.TS_STEPS AS [TEST_STEPS],  B.TC_STATUS AS [TC_STATUS], cast((CONVERT(VARCHAR(10), B.TC_EXEC_DATE, 101)) + ' ' + (CONVERT(CHAR(8), B.TC_EXEC_TIME, 108)) as datetime)  AS [TC_EXEC_DT],  case when ISNULL(B.TC_ACTUAL_TESTER,'')='' then B.TC_TESTER_NAME else B.TC_ACTUAL_TESTER end AS [ASSOCIATE_ID],  LEFT(A.CY_CYCLE,CHARINDEX('-',A.CY_CYCLE)-1) AS MNEMONIC
 FROM TD.CYCLE AS A, TD.TESTCYCL AS B, TD.TEST AS C  WHERE a.CY_CYCLE_ID = b.TC_CYCLE_ID  AND C.TS_TEST_ID=B.TC_TEST_ID  AND A.CY_CYCLE Like '%D-DC5-P%'
[+][-]02.12.2008 at 05:17AM PST, ID: 20874414

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Server 2005, Microsoft Access Database, Access Coding/Macros
Tags: Microsoft, MS Access 2003, SQL Server 2005, VBA, SQL, [Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.(#242), ODBC--call failed.
Sign Up Now!
Solution Provided By: TextReport
Participating Experts: 1
Solution Grade: A
 
 
[+][-]02.13.2008 at 09:32PM PST, ID: 20891169

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628