I have to execute a SQL statement into a SQL Server database using a TQuery component. I already used "INSERT INTO TABLE (FIELD1, FIELD2, ..) VALUES (:FIELD1, :FIELD2, ...)
ParamsByName('FIELD1').AsInteger := Variable1;
ParamsByName('FIELD2').AsInteger := Variable2;
The problem is: Variable2 can be null. In Oracle, I would use ParamsByName('FIELD1').AsString := Variable2, so if Variable2 is null it would by the same as ParamsByName('FIELD1').AsString := ''
In SQL Server that won't work, because FIELD2 is a smallint field and it doesn't allow me to use AsString. Any idea?