In SQL Assistant:
create Volatile table MyOldTable
(
Col1 Smallint Not Null
, Col2 Smallint
, Col3 Char(6))
Unique primary index (col1)
On Commit Preserve Rows
;
Insert Into MyOldTable (Col1, Col2, Col3)
Values (1,1,'One')
;
Insert Into MyOldTable (Col1, Col2, Col3)
Values (2,Null,'Twobl')
;
Insert Into MyOldTable (Col1, Col2, Col3)
Values (3,3,Null)
;
Insert Into MyOldTable (Col1, Col2, Col3)
Values (4,Null,Null)
;
Select
'Insert Into MyTable
(Col1, Col2, Col3) Values ('||
Coalesce(''''||Col1||'''','Null')
||','||
Coalesce(''''||Col2||'''','Null')
||','||
Coalesce(''''||Col3||'''','Null')
||');'
From MyOldTable
Order By Col1, Col2
;
Take the results from this select and paste into the Query window.