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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to select columns with only null values?

Status
Not open for further replies.

GEnki1331

Programmer
Mar 12, 2005
2
US
New to SQL

Is it possible to select columns with only null values?
I have a table with 65 columns one relates to a day and the rest relate to a time.(bowling alley schedule for school project) When a time is filled then null is replaced with the users number. Thats how its supposed to work.
But I cant figure out how to only select the columns with nulls. So the user can choose which time they want.
Help!

 
I think that only works for single a column. I need to show all the columns that have nulls in the table, so the user can decided which one to choose from. (Each column relates to a single time.) If there is abetter way to set up my table, please let me know i am willing to try anything.
 
just one idea --

create table slots
( thedate date not null
, slotno smallint not null
, primary key (thedate, slotno)
, theuser smallint null
)

insert into slots values
( '2005-03-13' , 1, null )
,( '2005-03-13' , 2, 9 )
,( '2005-03-13' , 3, null )
,( '2005-03-13' , 4, 37 )
,( '2005-03-13' , 5, null )
, ...

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (next course starts May 8 2005)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top