I'm trying to perform some upgrade maintenance on our database. I need to move 3 columns of data from all rows of one table and insert that data as new rows in a new table.
INSERT INTO [dbo].[SnmpSettings]([NetworkDiscoveryId], [RoCommunities], [RwCommunities])
SELECT id, Ro_Community, RW_Communities
FROM [dbo].[Network_Discovery]
The above code would work fine, but Ro_Community and RW_Communities allow NULL where as RoCommunities and RwCommunities do not allow NULL. How should I convert NULLs to the empty string and then insert into my new table?
EDIT:
INSERT INTO [dbo].[SnmpSettings]([NetworkDiscoveryId], [RoCommunities], [RwCommunities])
SELECT id, Ro_Community, RW_Communities
ISNULL(Ro_Community,'')
FROM [dbo].[Network_Discovery]
Msg 102, Level 15, State 1, Line 27
Incorrect syntax near 'Ro_Community'.
SELECT id, isnull(Ro_Community, ''), isnull(RW_Communities, '')