Use ISNULL to set the value to the default value when NULL

Use ISNULL to set the value to the default value when NULL

Post by Ken » Wed, 31 Jan 2001 12:05:42



Is there a way to use ISNULL to assign the default value at run time? I do not
want to hard code what the default value is and want it to be dynamic if the
default gets changed.



is an extra step. I thought I had seen somewhere that you can do it all in one

Thanks!  

 
 
 

Use ISNULL to set the value to the default value when NULL

Post by Tibor Karasz » Wed, 31 Jan 2001 16:20:21


Ken,

Something like below?

UPDATE tbl
SET colname = DEFAULT
WHERE colname IS NULL

If not, please post more details.

--
Tibor Karaszi, SQL Server MVP
FAQ from Neil at: http://www.sqlserverfaq.com
Please reply to the newsgroup only, not by email.


Is there a way to use ISNULL to assign the default value at run time? I do not
want to hard code what the default value is and want it to be dynamic if the
default gets changed.



is an extra step. I thought I had seen somewhere that you can do it all in one

Thanks!