Inserting data from a Power table into SQL database table

Ew!

All this to display the most recent values of tags?

Are the tags arranged in folders with identical inner tag names? (Or UDTs, which have the same effect?)

If so, a template that displays one row of tag values, using indirect binding, arranged in a template repeater, would be far more performant. With no SQL at all. (The template repeater would be set to dataset mode, and that dataset's one column would have the necessary tagpath strings.)