Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select query does not return all fields

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-16 : 10:29:34
Ross writes "Hi,

I'm getting some really strange results returning date fields from my server.

It seems that as soon as I access one of these types of field, any further queries on that record turn up blank. Once I move to the next record, I can return data fine, until I return a date value, at which point, I start getting blank values.

I'm running SQL 2000, and a sample SQL statement would be:
"SELECT Subject, Content, DIS_Posts.UserID, ValidFrom, Username FROM DIS_Posts, USR_Users WHERE DIS_Posts.UserID = USR_Users.UserID AND BoardID = '1' AND ValidTo IS NULL ORDER BY ValidFrom;"

UserID and BoardID are of type int,
ValidFrom is a smalldate field,
Subject and username are nvarchar,
Content is ntext

username is stored in the USR_Users table, all the rest is from the DIS_Posts table.

Normally, I would query the database in the order: Subject, Content, ValidFrom, Username, UserID.

Having done some testing, if I read the date first, Subject will display okay, but neither Content nor username return values. If I try to read the date after the Content, I don't get a value returned for the date!

Please help, I'm sure I'm missing something obvious, but can't find anything to tell me what's going on.

Ross

P.S. The e-mail address I submitted does work, despite appearances :)"
   

- Advertisement -