Hi Mani,
I suggest you test the script part by part and then go for the stored proc. See this example I create: I use trim and the result comes with a ddl which I can create back up. I am not aware of the reason you are using dbc.column. I feel your select distinct too you need to use trim.
select 'create table '||trim(databasename)||'.'||trim(tablename)||'_bkp as (sel * from '|| trim(databasename)||'.'||trim(tablename)||' ) with data' from dbc.tables
where databasename='ABC' and tablename='def'.
Next you try for add partition. Hope you got this logic as a first step as i understand you want to take backup.Next you can substitute vTABLENAME
Are you being directed to use stored procedure only or you can use bteq etc too?
Cheers,
Raja
Hi Mani,
I suggest you test the script part by part and then go for the stored proc. See this example I create: I use trim and the result comes with a ddl which I can create back up. I am not aware of the reason you are using dbc.column. I feel your select distinct too you need to use trim.
select 'create table '||trim(databasename)||'.'||trim(tablename)||'_bkp as (sel * from '|| trim(databasename)||'.'||trim(tablename)||' ) with data' from dbc.tables
where databasename='ABC' and tablename='def'.
Next you try for add partition. Hope you got this logic as a first step as i understand you want to take backup.Next you can substitute vTABLENAME
Are you being directed to use stored procedure only or you can use bteq etc too?
Cheers,
Raja