1

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.

1
  • And the view looks like...?
    – gbn
    Commented Jul 14, 2011 at 10:21

1 Answer 1

3

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"

2
  • +1 I thought that only oracle has so problems. :). Ms is growing up to the level of oracle and does the same mistakes. :)
    – garik
    Commented Jul 14, 2011 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. Commented Jul 14, 2011 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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