I have records from server that I want to copy, so I used datareader to select all, during selection the insert also process. This is the pseudo code:
while datareader.read
For f As Integer = 0 To datareader.FieldCount - 1
Values = Values & datareader.GetValue(f)
Next
Dim ss as string ="Insert into xtable(a,b,c,d,e,f) select " & values & " where not Exist (select * from xtable)" ''//is this right?
Dim sc as new sqliteCommand(ss,mycon)
sc.ExecuteNonQuery
End While
sc.dispose
What is the exact sql statement to insert only if record doesn't exist in my current table?
I used some of this code, but a filter was defined: like x What if I just want to insert records that doesn't exist in the table I want.
Dim ss As String = "insert into xtable(x,y,z) select $x, $y,$z
where not exists (select 1 from xtable where x=$x)"