Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select statement returns empty results

Status
Not open for further replies.

ifx

Technical User
Feb 26, 2002
57
GB
Hi there,

This is really causing me a headache:
I have a table which looks a little like the following structure (field names have been changed to protect the innocent):
CREATE TABLE `demo_table` (
`ID` bigint(20) unsigned NOT NULL auto_increment,
`fieldOne` text,
`fieldTwo` text,
`fieldThree` tinytext,
`fieldFour` tinyint(3) unsigned default NULL,
`fieldFive` datetime default NULL,
`fieldSix` text,
`fieldSeven` int(10) unsigned default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `ID` (`ID`),
KEY `ID_2` (`ID`)
) TYPE=MyISAM COMMENT='This is a test table';

Now thr problem is when I run a select statement I get an empty result set back if I only select one field. EG:
SELECT fieldTwo FROM demo_table
or
SELECT DISTINCT(fieldTwo) FROM demo_table
I get the right number of results back but the fields a totally empty. I ran it through .NET and using MySQL Front and they both return the same. However, if I do this:
SELECT ID, fieldTwo FROM demo_table
then I get all the right stuff back. However:
SELECT fieldTwo, ID FROM demo_table
doesn't work.
Basically it appears that only if you specify ID as the first column to select does it return a filled results set.

This seems like a really basic problem to me, but I've never come across anything like this before (I'm more of a MS SQL person though!)

Thanks a lot for your help!!
 
Nah, this a ADO problem. Null text columns CAN NOT be null, we ran into this and have an space in the field

Bastien

Cat, the other other white meat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top