There's a tricky nuance that you must take into account when you make schema changes in MS SQL. When we discovered the following behavior I looked to see if I could find it blogged or documented somewhere. Failing that, I thought someone else out there might benefit from hearing about this issue. You might run into problems if you are dealing with the following conditions:
h4>How we discovered it
We first found out about this bug when we made a minor modification to an application that was built by a third party. The application had a view created with code similar to this:
This view was used to select featured items in an e-commerce type applications. We needed to add a field to the ITEM_LIST table. After we added the field we got a variety of similar errors for queries accessing the view - queries that had previously worked. All of the errors were type binding errors. The JDBC driver was complaining that the type being bound to the column via <cfqueryparam ...> did not match the type of the actual column in question.
For example, we had the following query:
It turns out that 2 things are going on.
WHERE lastname LIKE ('%Johnson%'). Talk about a head scratcher. I might try to test that out and see if it's possible. Restart CF server, right? Nope - you have to get both sides synchronized. First, refresh the view. I do this in query analyzer using the "alter view" code (right click on the view and choose "script to new window as alter"). Simple run the alter view without changing the syntax and it will refresh the schema for you. Then you will need to restart CF. I know that doesn't make sense. It would seem like getting them both on the same schema by refreshing the view would do the trick. I can only surmise that refreshing the view changes the ordering yet again - perhaps based on indexing and execution plan. If you have heard of this issue or have any correction or insight into my suppositions let me know.
(you'd probably never do this but...) creating a temp table then doing a "select *...", altering it by adding a column and then another "select *..." ?
just curious
barry.b