Copy contents of an MS SQL database table to another lazarus / 16-Databases ---------------------------------------------------------------------- georges · 2015-12-04 13:10 Hi We would like to bulk copy a subset of the contents of an MS SQL database table to another.   We are using the following commands: SQLQuery_Loy.SQL.Text := ('insert into USR_LOY (CUST_NO) select CUST_NO from CUSTOMERS' where LOY = 'Y'); SQLQuery_Loy.Open; SQLQuery_Loy.ExecSQL; SQLTransaction_Loy.Commit;    However, we are getting the following error at run time: SQLQuery_Loy : Cannot open a non-select statment What would be the correct way to do this? Regards, ---------------------------------------------------------------------- Swirl · 2015-12-04 13:13 I guess you use OPEN to read and EXECSQL for writing/modifying ? So try EXECSQL and drop your OPEN... Regards Swirl ---------------------------------------------------------------------- georges · 2015-12-04 13:29 Hi Swirl That simple change did the trick.  Thanks a lot.