Skip to main content
Participant
March 26, 2007
Question

how to refresh a data source when adding fields?

  • March 26, 2007
  • 2 replies
  • 441 views
I have a MSSQL2K database which I add and remove fields on every so often. Generally speaking the new field doesn't show up in a query until I either restart the CF server or refresh the data source (in cfadmin) by renaming it.

Same goes if I change the order of the fields in the database - CF seems to have some kind of map of the table in which the order of fields is significant.

For example if I have a table like this: [ id,name,rank] and add in a field [id,name,rank,serial] the final field won't show. Once the CF server is reset it's fine. More strangely, if I then change the table to [id,name,serial,rank] subsequent queries will show "rank" data in the "serial" column. Again restarting the CF server fixes the problem.

I have noticed that using cachedwithin seems to go some way to addressing the problem, but most of my queries use <cfquerparam> so it's not useful.

I'm running CF7 on a WIN2k box.

Has anyone else experienced this?
This topic has been closed for replies.

2 replies

Inspiring
March 27, 2007
Has anyone else experienced this?


Yes, this is a known issue when using SELECT * statements. IIRC it is a
data driver issue, so updating the drivers may affect this. But it is a
big reason behind the recommendation to not use SELECT *, but rather
list out the columns by name. When you do so, you will not run into
this column name caching behavior.

Participating Frequently
March 27, 2007
There are two ways I get around this when I'm fleshing out a table...

1. List each field in the query rather than "SELECT *".
2. In the CF admin set "Max Pooled Statements" to 0 (Zero) for that datasource.