Copy View?

Database
Enthusiast

Copy View?

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: Copy View?

Hi.

 

Not sure about your SQL to pull the View, but the one used with tables won't work.

 

You should do 'SHOW VIEW' statements instead and redirect them to a file.

 

HTH.

 

Cheers.

 

Carlos.