Rabbo Posted February 7, 2013 Report Posted February 7, 2013 All query gurus In Teradata I have to drop a table before creating the same table......... ela ante if table exists drop table xyz.test else null and later create table xyz.test query ela rayalo chepandi, important point ente ante table exist avthane drop chesi malli same table ni create cheyali query or a series of querys
deals2buy Posted February 7, 2013 Report Posted February 7, 2013 [CODE] SELECT 1 FROM DBC.TABLES WHERE Databasename = '' AND Tablename (= '' or like '%%'); .if activitycount = 0 then .goto no_tab; .if errorcode <> 0 then .goto unsuccessful_end; DROP TABLE $dwh.table_name; .if errorcode <> 0 then .goto unsuccessful_end; .label no_tab; - - - - - .label unsuccessful_end; exit 12; [/CODE] PS: googled.. I am not a TERADATA developer.. Also check this: http://stackoverflow.com/questions/9299329/create-table-but-drop-it-if-the-table-exists-already
Rabbo Posted February 7, 2013 Author Report Posted February 7, 2013 Try chesta .......thanks bhayya inka emanna answer lu istharo chusta [quote name='Kaarthikeya' timestamp='1360279453' post='1303244636'] [CODE] SELECT 1 FROM DBC.TABLES WHERE Databasename = '' AND Tablename (= '' or like '%%'); .if activitycount = 0 then .goto no_tab; .if errorcode <> 0 then .goto unsuccessful_end; DROP TABLE $dwh.table_name; .if errorcode <> 0 then .goto unsuccessful_end; .label no_tab; - - - - - .label unsuccessful_end; exit 12; [/CODE] PS: googled.. I am not a TERADATA developer.. Also check this: [url="http://stackoverflow.com/questions/9299329/create-table-but-drop-it-if-the-table-exists-already"]http://stackoverflow...-exists-already[/url] [/quote]
mastikaraja Posted February 7, 2013 Report Posted February 7, 2013 select * from sys.tables where name like (searches the table name in the database) drop the searched table and then create the table.
Rabbo Posted February 7, 2013 Author Report Posted February 7, 2013 table exist avuthane drop chesi malli table create cheyali table exist avakpothe em drop cheyakunda table create cheyali [quote name='mastikaraja' timestamp='1360280867' post='1303244771'] select * from sys.tables where name like (searches the table name in the database) drop the searched table and then create the table. [/quote]
kranthi111 Posted February 8, 2013 Report Posted February 8, 2013 IF EXISTS ( SELECT 1 FROM sys.tables WHERE name like 'TableName') BEGIN DROP TABLE TableName END else begin create table() end
nani8055 Posted February 8, 2013 Report Posted February 8, 2013 [quote name='kranthi111' timestamp='1360283746' post='1303244926'] IF EXISTS ( SELECT 1 FROM sys.tables WHERE name like 'TableName') BEGIN DROP TABLE TableName END else begin create table() end [/quote] nee ID chalaa bhaagundhi..... nice name.......
kranthi111 Posted February 8, 2013 Report Posted February 8, 2013 [quote name='nani8055' timestamp='1360283888' post='1303244931'] nee ID chalaa bhaagundhi..... nice name....... [/quote]
jangri Posted February 8, 2013 Report Posted February 8, 2013 [quote name='Rabbo' timestamp='1360278788' post='1303244558'] All query gurus In Teradata I have to drop a table before creating the same table......... ela ante if table exists drop table xyz.test else null and later create table xyz.test query ela rayalo chepandi, important point ente ante table exist avthane drop chesi malli same table ni create cheyali query or a series of querys [/quote] No idea [img]http://www.desigifs.com/sites/default/files/bemi.gif[/img]
deals2buy Posted February 8, 2013 Report Posted February 8, 2013 [quote name='nani8055' timestamp='1360283888' post='1303244931'] nee ID chalaa bhaagundhi..... nice name....... [/quote] needi kuda ade name aa? [img]http://lh3.ggpht.com/--o7mXz3u-j4/T9VVBGzBJAI/AAAAAAAAGo0/kmj8a1-XW2g/s150/PK-1.gif[/img]
jangri Posted February 8, 2013 Report Posted February 8, 2013 [quote name='Kaarthikeya' timestamp='1360285213' post='1303245032'] needi kuda ade name aa? [img]http://lh3.ggpht.com/--o7mXz3u-j4/T9VVBGzBJAI/AAAAAAAAGo0/kmj8a1-XW2g/s150/PK-1.gif[/img] [/quote] [img]http://www.desigifs.com/sites/default/files/brahmam_style19_1.gif[/img]
Recommended Posts