drop-table

Drop multiple tables in one shot in mysql

狂风中的少年 提交于 2019-12-29 11:30:45
问题 How to drop multiple tables from one single database at one command. something like, > use test; > drop table a,b,c; where a,b,c are the tables from database test. 回答1: Example: Let's say table A has two children B and C. Then we can use the following syntax to drop all tables. DROP TABLE IF EXISTS B,C,A; This can be placed in the beginning of the script instead of individually dropping each table. 回答2: SET foreign_key_checks = 0; DROP TABLE IF EXISTS a,b,c; SET foreign_key_checks = 1; Then

Dropping a table in SAS

末鹿安然 提交于 2019-12-21 07:34:18
问题 What is the most efficient way to drop a table in SAS? I have a program that loops and drops a large number of tables, and would like to know if there is a performance difference between PROC SQL; and PROC DATASETS; for dropping a single table at a time.. Or if there is another way perhaps??? 回答1: If it is reasonable to outsource to the OS, that might be fastest. Otherwise, my unscientific observations seem to suggest that drop table in proc sql is fastest. This surprised me as I expected

How to solve : SQL Error: ORA-00604: error occurred at recursive SQL level 1

天涯浪子 提交于 2019-12-21 05:18:08
问题 When I'm trying to drop table then I'm getting error SQL Error: ORA-00604: error occurred at recursive SQL level 2 ORA-01422: exact fetch returns more than requested number of rows 00604. 00000 - "error occurred at recursive SQL level %s" *Cause: An error occurred while processing a recursive SQL statement (a statement applying to internal dictionary tables). *Action: If the situation described in the next error on the stack can be corrected, do so; otherwise contact Oracle Support. 回答1: One

Create table but Drop it if the table exists already

淺唱寂寞╮ 提交于 2019-12-19 09:25:04
问题 I am working on a request where I have to create a table to insert some data. So, obviously I will have first have a delete table st. before the create st. but when I am running this for the first time(before the table can be created) it will pop up an error saying table not created and then creates table and goe son from here. So every time any one runs my code for the first time it will pop up this error at drop table st. Does any one have any better idea?? Some thing like " if table exists

SQL DROP TABLE foreign key constraint

血红的双手。 提交于 2019-12-17 14:59:48
问题 If I want to delete all the tables in my database like this, will it take care of the foreign key constraint? If not, how do I take care of that first? GO IF OBJECT_ID('dbo.[Course]','U') IS NOT NULL DROP TABLE dbo.[Course] GO IF OBJECT_ID('dbo.[Student]','U') IS NOT NULL DROP TABLE dbo.[Student] 回答1: No, this will not drop your table if there are indeed foreign keys referencing it. To get all foreign key relationships referencing your table, you could use this SQL (if you're on SQL Server

how to solve this- Cannot delete or update a parent row: a foreign key constraint fails

Deadly 提交于 2019-12-11 15:05:06
问题 I'm trying to drop table and I'm getting this error : Cannot delete or update a parent row: a foreign key constraint fails Some could help me please : the statement : DROP TABLE vehiculo the error : #1217 - Cannot delete or update a parent row: a foreign key constraint fails the tables that have a relationship with vehiculo: CREATE TABLE `vehiculo` ( `numero_movil` int(3) unsigned NOT NULL, `numeroChasis` varchar(30) COLLATE utf8_spanish2_ci NOT NULL, `numeroMotor` varchar(30) COLLATE utf8

Unable to drop database in SQL Server 2012

天大地大妈咪最大 提交于 2019-12-11 05:23:07
问题 I have created a sample database earlier and now I want to delete that database, but it is not getting deleted. I searched online but I didn't find any solution which is working. Using T-SQL, I tried: USE [Sample] ALTER DATABASE [Sample] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; GO DROP DATABASE [Sample] Using the GUI, I am getting this below error: I closed existing connection then also this is happening and this is my local machine. Please help me here! 回答1: use this code: USE MASTER GO

Dropping a table in SAS

夙愿已清 提交于 2019-12-04 01:13:07
What is the most efficient way to drop a table in SAS? I have a program that loops and drops a large number of tables, and would like to know if there is a performance difference between PROC SQL; and PROC DATASETS; for dropping a single table at a time.. Or if there is another way perhaps??? If it is reasonable to outsource to the OS, that might be fastest. Otherwise, my unscientific observations seem to suggest that drop table in proc sql is fastest. This surprised me as I expected proc datasets to be fastest. In the code below, I create 4000 dummy data sets then try deleting them all with

How to drop all tables in database without dropping the database itself?

跟風遠走 提交于 2019-12-03 05:46:22
问题 I would like to delete all the tables from database, but not deleting the database itself. Is it possible ? I'm just looking for shorter way than removing the database and create it again. Thanks ! 回答1: The shortest is to re-create database. but if you don't want to... This is for MySQL/PHP. Not tested but something like that. $mysqli = new mysqli("host", "my_user", "my_password", "database"); $mysqli->query('SET foreign_key_checks = 0'); if ($result = $mysqli->query("SHOW TABLES")) { while(

How to drop all tables in database without dropping the database itself?

女生的网名这么多〃 提交于 2019-12-02 19:05:27
I would like to delete all the tables from database, but not deleting the database itself. Is it possible ? I'm just looking for shorter way than removing the database and create it again. Thanks ! The shortest is to re-create database. but if you don't want to... This is for MySQL/PHP. Not tested but something like that. $mysqli = new mysqli("host", "my_user", "my_password", "database"); $mysqli->query('SET foreign_key_checks = 0'); if ($result = $mysqli->query("SHOW TABLES")) { while($row = $result->fetch_array(MYSQLI_NUM)) { $mysqli->query('DROP TABLE IF EXISTS '.$row[0]); } } $mysqli-