Is it possible to insert all records from a resident table into an db table from qlikview script and in 1 shot?
No. You'll need more shots. One for exporting the table to a csv file and one to import the csv file in your database. Perhaps your dbms supports csv files as virtual tables. That could make it a bit easier.
I had the same problem, but with by making a string of the variables and inserting 1000 rows at a time, decreasing the load time exponentaily. Due to some of the values in the fields I hade to swith between ' for delimiter and Chr(39).
I created a script that does bulk inserts in series of 1,000 rows per dump. Hence, say for a table/QVD of 12,345 rows, the script will do 12 dumps of 1,000 each and then a dump of the last 345 rows. I think a number of individuals have also thought about this, such as David G.
Since this script is based on using a QVD at source, I am sure you can re-use the latter part to write from a RESIDENT table, the process is the same. You would have to be cautious in your 'data types' and what it is in the source table.
My script was build in order for the script to first build the SQL table and then load the data into it, which would ensure the 2 are consistent and won't produce errors.