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.
Author |
Topic |
gurukmoon
Starting Member
2 Posts |
Posted - 2014-07-01 : 14:35:04
|
tablename_1id column1 term_loan(tablename_2.column2)*log(tablename_2.column3)2 max(tablename_2.column3)+log(tablename_2.column2)*583 log(term_loan(tablename_2.column2))+58* max(tablename_2.column3)table_2id column2 column31 25000 300002 null 150003 -15000 null4 null 45000this table contains formulas column which contains another table column values.while retrieving data if those columns contains null values i need to replace it with 0.(for this i need to write case statmnt n replace those case statmnt with column names in the formula column.)but, for log it is a problem as log(0) is undefined so i need to write case statemnt to replace null values with 1 wherever log is there.ex:output: id column 1 term_loan(case when(tablename_2.column2) is null 0 else (tablename_2.column2))*log(case when(tablename_2.column2) is null 0 else (tablename_2.column3))so onam using this column function in a variable in my stored procedure |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-01 : 15:13:51
|
I don't understand your post, but I think you can just use the ISNULL or COALESCE functions for the columns that do contain nulls.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
gurukmoon
Starting Member
2 Posts |
Posted - 2014-07-02 : 00:13:31
|
am using this column as a variable in my stored procedure to get the score |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-07-02 : 00:54:38
|
looks like you need Dynamic SQL KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|