I wish to process many tables with the same SQL code - take data from an imported table and then create a new table and drawing.
I am attempting to generate a general Query for this purpose where I simply add the imported table name at the top as a global variable and then all else would follow. I then generate other global variables based on this name.
I had thought of the following code included below as the start but found it did not work. I then created the table with hard wired names and read the PragmaValue name into a global variable. But this did not work for the functions that followed. I assume that i am not using the global variables correctly in place of table names. All the examples I have seen relate to the use of global variables in field names rather than table names.
I would greatly appreciate some guidance here.
VALUE @ImportedTableName NVARCHAR = '[ImportedTable]'
VALUE @NewDrawingName NVARCHAR = @ImportedTableName + '_Lines'
VALUE @NewTableName NVARCHAR = @NewDrawingName + 'Table'
CREATE TABLE @NewTableName (
INDEX [mfd_id_x] BTREE ([mfd_id]),
INDEX [Geom_x] RTREE ([Geom]),
PROPERTY 'FieldCoordSystem.Geom' ComponentFieldCoordSystem(@ImportedTableName, 'Geom')
INSERT INTO @NewTableName (
FROM @ImportedTableName GROUP BY [LineID];