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)
 selecting * and null values

Author  Topic 

boomboom
Starting Member

6 Posts

Posted - 2003-09-29 : 17:30:35
Is it possible within a "SELECT *" to replace NULL values just as IFNULL does when selecting from specific fields?

If not, what is the more efficient way to do it, having SQL Server replace them by selecting the individual fields or by having my VB code replace them after doing the select?

TIA

nr
SQLTeam MVY

12543 Posts

Posted - 2003-09-29 : 17:57:51
No.
You shouldn't do a select * anyway.
Better to name all the columns then you can manipulate them individually.

If you want to get the list of columns

select name + ' ,' from syscolumns where id = object_id('mytable') order by colid

Could use the information schema views but I can remember this without looking it up.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

airjrdn
Starting Member

35 Posts

Posted - 2003-09-30 : 11:54:19
I'd recommend against doing a select * also if you can get away from it. If not, I'd replace them in VB by doing something along the lines of:

txtMiddleInitial = CStr(loRS("MiddleInitial") & VBNullString)

This will set txtMiddleInitial to "" if loRS("MiddleInitial") is bringing back a Null from the database.

Go to Top of Page
   

- Advertisement -