Hello All,
I have resolved this problem,
IF OBJECT_ID('tempdb..#temp' ) IS NOT NULL DROP TABLE #temp;
IF OBJECT_ID('tempdb..#temp1') IS NOT NULL DROP TABLE #temp1;
CREATE table #comman
( abc varchar(10),
d varchar(10),
e varchar(10),
f varchar(10) );
If type ='A'
BEGIN
select abc,d,e,f into #temp from mst_temp
END
ELSE
BEGIN
select abc,d,temp1,'' as f into #temp1 from mst_temp
END
if type='A'
Insert into #comman(abc,d,e,f) from #temp
else
Insert into #comman(abc,d,e,f) from #temp1
select * from #comman;
drop table #comman
I have just used insert instead of select and create table structure
becoz due to select its create new table.
Thanks all of you