I work on db2 database . I get error when create table inside database but I don't know how to solve this error .
I create table from db2 command windows Administrator
text file TestTables.sql contain query need executed by db2 as below
Create TABLE books (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL , author VARCHAR(255) NOT NULL , title VARCHAR(255) NOT NULL , isbn INT NULL , PRIMARY KEY(id));
what I try
db2 => tvf C:\Users\MBR\Desktop\TestTables.sql
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0007N The statement was not processed because a character that is not
supported in SQL statements was included in the SQL statement. Invalid
character: "\". Text preceding the invalid character: "tvf C:".
SQLSTATE=42601
so How to solve this error please ?
Tahir AnsariPosted Oct 8, 2023, 3:26 AM
because you are trying to execute a SQL file using the "tvf" (Table Value Function) command in the DB2 command line processor, but the "tvf" command is not recognized, and the backslashes in the file path are causing issues. To execute SQL scripts in DB2, you should use the db2 -tvf command.