If relevant, I'm using IBM i V7R1M0.
I have some code in C#:
var generateSqlSql = $@"
CALL QSYS2.GENERATE_SQL(
'{obj.Name}',
'{obj.Library}',
'VIEW',
CREATE_OR_REPLACE_OPTION => '1',
HEADER_OPTION => '0',
COMMENT_OPTION => '1',
PRIVILEGES_OPTION => '0',
LABEL_OPTION => '0'
)";
...
//get results
//split on semicolon
//change library
//write back to database
The sql that it's then trying to write is:
CREATE OR REPLACE VIEW AMMLIBC.BBI_USER_MY_VIEW FOR SYSTEM NAME BBIU_00001 (
/* view columns */ )
AS
/*view definition */
RCDFMT BBIU_00001
When I try to run it, it gives the following error:
iDB2SQLErrorException: SQL7029 New name BBIU_00001 is not valid.
...Why? What's causing this, and how do I make it work?