Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Missing Field in Query

Explorer ,
Apr 20, 2008 Apr 20, 2008
I'm hoping I'm just doing something very stupid. I have CF8.01 and SQL Server 2005. I have a simple table for which I recently added a column, with the default value of NULL. When I do a query of all fields from within SQL Management Studio the results include all fields, including the latest column. There are no errors in SQL Server when I add the column or manually add data.

In CF 8 however, a <cfquery> for all fields in that table fails to find the new column - I've used CFDump to verify. The field simply doesn't show up. The query is not cached. No errors are returned to CF. This should have been a relatively easy update to my project, but it's turned into a real stumper.

Any ideas or suggestions? Thanks in advance!

TOPICS
Database access
836
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 20, 2008 Apr 20, 2008
Just a suggestion: Write a quick insert query to write a record to that table, including a value for the new column. If there are any caching issues they should disappear when you try to read the table again. If you get a CF error it may pinpoint the problem.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2008 Apr 20, 2008
The first thing I would try is
select newfield
from yourtable
where 1 = 2
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 20, 2008 Apr 20, 2008
John and Jim,

Thanks for the suggestions. I have not tried inserting a record via CF yet and will do. As for a test select, I did try that and it simply does not see the new field. The error is that I'm requesting an invalid table field... Very strange.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2008 Apr 20, 2008
clear your caches (all of them) in cf admin.
stop using SELECT * in your queries (that's what you get when you do).
make sure you are connecting to same db from cf as from SQL Studio.


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2008 Apr 20, 2008
Getting back to your original question about doing something stupid, if this were my problem, a likely cause would be a development/production database mixup.

But it's not. If the insert doesn't work, try dropping and recreating the datasource.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 20, 2008 Apr 20, 2008
LATEST
Dan - sorry, don't know where john came from!

I restarted SQL Server and then CF recognized all fields. So i am still not certain what was going on, but that did the trick. Thanks for the the assistance!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources