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
 General SQL Server Forums
 New to SQL Server Programming
 skip null value while inserting the rows

Author  Topic 

newuser123
Starting Member

7 Posts

Posted - 2010-01-07 : 05:02:29
I have one table tb1 as follow

col1 col2
1 a
1 b
1 c
1 null
1 null
2 d
2 w
2 o
3 q
3 null


i want to insert above rows into tb2 with skipping null values
so output should be

col1 co12
1 a
1 b
1 c
2 d
2 w
2 o
3 q

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-07 : 05:09:16
insert tb2 (col1, col2)
select col1,col2
from tb1
where col2 is not null


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -