Failure 3707

General
Enthusiast

Failure 3707

When I want to copy and create a table with no data, but stats, I run the following

SEL 'CT newdb'||'.'||TRIM(TableName)||' AS '||trim(databasename)||'.'||TRIM(TableName)||' WITH NO DATA AND STATS'||';'
from DBC.TablesV
where databasename='olddb'

I select the result>delete the database> then run the output of that first select statement


When I want to copy and create view, I am receiving error on SQLA
Create view Failed:3707; Syntax error, expected something like a 'SELECT' keyword or a 'lock' keyword or '(' or a 'TRANSACTIONTIME' keyword between the 'AS' keyword and the word ' olddb'

How can I fix the first script above? I replaced CV/Create View from CT, but that doesn't help


Thanks
1 REPLY 1
Highlighted
Teradata Employee

Re: Failure 3707

There is no SQL statement to "copy" a view; you can retrieve the existing definition with SHOW VIEW and edit that.

Often you will need to change more than just the name of the view itself, e.g. the names of the referenced objects.