Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a view definition that references a linked JDE server. Querying the view is now giving some very strange results. If I perform a SELECT * I get all the results (619 rows) back but if I try SELECT TOP 1000 * or query for each column individually I get the following error:

Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the varchar value 'A' to data type int.

UPDATE: Thanks for the suggestions. It turned out to be a data issue where someone has added codes A, G, and R to the JDE table used to hydrate a relationship that requires an int code in SQL Server. It doesn't explain the weird behaviour but it does address it.

share|improve this question
    
And the view looks like...? –  gbn Jul 14 '11 at 10:21
add comment

1 Answer 1

I suspect you need to run sp_refreshview

See this on SO "“select * from table” vs “select colA, colB, etc. from table” interesting behaviour in SQL Server 2005"

share|improve this answer
    
+1 I thought that only oracle has so problems. :). Ms is growing up to the level of oracle and does the same mistakes. :) –  garik Jul 14 '11 at 13:43
    
Thanks for your suggestion - It didn't help (see my comment above) but I'll keep it in mind for future reference. –  David Clarke Jul 14 '11 at 21:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.