I have a need to insert a default value for a column in a TPT script. basically i am trying to do an insert into a table specifying a job variable as one of the values, and i have been unable to do so up to this point. My table is as follows:
CREATE TABLE MyTable (
column0 VARCHAR(16) CHARACTER SET LATIN,
column1 VARCHAR(16) CHARACTER SET LATIN
) NO PRIMARY INDEX;
INSERT INTO MyTable (
) values (
where i have in my job variables file:
upon execution i get the following error:
TPT10508: RDBMS error 3857: Cannot use value (or macro parameter) to match 'columnValue'.
i have also tried defaulting the column value for the column1 in the schema creation as follows:
column1 VARCHAR(16) CHARACTER SET LATIN DEFAULT @columnValue
but that failed, as:
any suggestions, and as always, thanks in advance.
In your TPT script you need to code the SQL statement as a concatenation of basic SQL with the variable name.
APPLY ('INSERT INTO MyTable ( column0, column1 ) values ( '''test''','||@columnValue||');')
thank you Dave, that took care of the issue. the triple tick concatenation did the trick:
APPLY ('INSERT INTO MyTable
( column0, column1 )
Again, thanks for the help,