SQL SP
-
Hi My Stored Procedure output is as below given. Interval Avg1 Avg2 NULL NULL NULL 04/08 NULL NULL 05/08 2000 NULL NULL 1000 NULL NULL NULL NULL NULL NULL 4000 NULL NULL 3000 I want result in two rows as below given. Interval Avg1 Avg2 04/2008 2000 4000 05/2008 1000 3000 Please let me know how i can do this using temm table ? Thanks Care Career
-
Hi My Stored Procedure output is as below given. Interval Avg1 Avg2 NULL NULL NULL 04/08 NULL NULL 05/08 2000 NULL NULL 1000 NULL NULL NULL NULL NULL NULL 4000 NULL NULL 3000 I want result in two rows as below given. Interval Avg1 Avg2 04/2008 2000 4000 05/2008 1000 3000 Please let me know how i can do this using temm table ? Thanks Care Career
Based on the info you posted, the only thing I can imagine is that you should modify the output from sp to give you what want. So, you need to include to the post, how the result is made in sp and what do you want to change or if you cannot change the sp, what is the logic you want to achieve with temp tables (why 04/2008 has 4000 in avg2, since there is nothing in the data combining the row "NULL NULL 4000" to the row "04/08 NULL NULL" Mika
The need to optimize rises from a bad design
-
Based on the info you posted, the only thing I can imagine is that you should modify the output from sp to give you what want. So, you need to include to the post, how the result is made in sp and what do you want to change or if you cannot change the sp, what is the logic you want to achieve with temp tables (why 04/2008 has 4000 in avg2, since there is nothing in the data combining the row "NULL NULL 4000" to the row "04/08 NULL NULL" Mika
The need to optimize rises from a bad design
Hi I do not want to change my existing SP I just want output as below given.I want to remove NULL Please help.. Sr No Interval Avg1 Avg2 1 04/2008 2000 4000 2 05/2008 1000 3000
-
Based on the info you posted, the only thing I can imagine is that you should modify the output from sp to give you what want. So, you need to include to the post, how the result is made in sp and what do you want to change or if you cannot change the sp, what is the logic you want to achieve with temp tables (why 04/2008 has 4000 in avg2, since there is nothing in the data combining the row "NULL NULL 4000" to the row "04/08 NULL NULL" Mika
The need to optimize rises from a bad design
I want to remove NULL from below given resultset.If I will remove NULL then data will come in two rows.SO how Can i do this using temp table? please help its urgent. Interval Avg1 Avg2 NULL NULL NULL 04/08 NULL NULL 05/08 2000 NULL NULL 1000 NULL NULL NULL NULL NULL NULL 4000 NULL NULL 3000 Thanks Care Career
-
Hi My Stored Procedure output is as below given. Interval Avg1 Avg2 NULL NULL NULL 04/08 NULL NULL 05/08 2000 NULL NULL 1000 NULL NULL NULL NULL NULL NULL 4000 NULL NULL 3000 I want result in two rows as below given. Interval Avg1 Avg2 04/2008 2000 4000 05/2008 1000 3000 Please let me know how i can do this using temm table ? Thanks Care Career
listen, first i assume columns are varchar,int,int type if column is varchar type you can use isnull() funtion like this:
select,...,isnull(avg1,'') FROM mytable
that way you will get an empty slot. if you want to erase all row with null values type
select * from mytable where (interval <> null) and (avg1 <> null) and (avg2 <> null)
what you type is wrong, you can´t get that, columns not from the same row!!! about temp table forget it, you don´t need that ... for now :omg:
nelsonpaixao@yahoo.com.br trying to help & get help
-
Hi I do not want to change my existing SP I just want output as below given.I want to remove NULL Please help.. Sr No Interval Avg1 Avg2 1 04/2008 2000 4000 2 05/2008 1000 3000
This simply isn't possible unless there is some kind of logic why the result set should look like you described. If your result set in the start is:
Interval Avg1 Avg2
NULL NULL NULL
04/08 NULL NULL
05/08 2000 NULL
NULL 1000 NULL
NULL NULL NULL
NULL NULL 4000
NULL NULL 3000and you want:
Interval Avg1 Avg2
04/2008 2000 4000
05/2008 1000 3000Please explain for example why the last row having 3000 in Avg2 should be combined with the row having 05/08 as interval. Also why the value 2000 on the same row is moved to the row 04/08 and so on... One crucial thing is that you think this as result sets having rows with conditions since this is the way the DBMS does it.
The need to optimize rises from a bad design