Questions tagged [sql-drop]

`DROP` is a keyword in sql. It is used for dropping tables, triggers, schema, procedure etc.

DROP keyword is used for dropping tables, triggers, schema, procedure etc.

Sample code:

DROP TABLE tableName;

Reference

159 questions
3
votes
2 answers

MySQL command to drop all non-primary indexes of a table

Is there a MySQL command that can drop all the extra indexes except for the first one in a single table thus keeping only the primary index? I can drop the second Post_Date index using the following MySQL command, but I am having problems dropping…
Sammy
  • 877
  • 1
  • 10
  • 23
2
votes
2 answers

Error message when dropping constrain

Every time I want to drop a constraint from a column I get an error. I can't see the problem. I am using postgres. So I have created a table with two columns: CREATE TABLE TableA( person_id INT PRIMARY KEY, lastname CHAR(100) ) I use the code ALTER…
2
votes
3 answers

Oracle performance when dropping all tables

I have the following Oracle SQL: Begin -- tables for c in (select table_name from user_tables) loop execute immediate ('drop table '||c.table_name||' cascade constraints'); end loop; -- sequences for c in (select sequence_name from user_sequences)…
jjnguy
  • 136,852
  • 53
  • 295
  • 323
2
votes
3 answers

How to drop all triggers in a Firebird 1.5 database

For debug purposes I need to send 1 table of an existing Firebird 1.5 database to someone. In stead of sending the whole db , I want to send just the db with just this table - no triggers, no constraints. I can't copy the data to another db because…
Edelcom
  • 5,038
  • 8
  • 44
  • 61
2
votes
8 answers

How to drop Stored Procedures in a SQL 2000 + SQL 2005 compatible manner?

I have a project that requires me to do development in SQL Server 2005, but do deployments to a SQL Server 2000 box. For 99% of the SQL code, I have no problems, everything appears to be backwards compatible. Now I am just about to start adding all…
2
votes
1 answer

Enforce SQL Server to drop a database

When I'm using Management Studio Express to drop a database there is an checkbox "Close existing connections." which close open database and enforce it to drop. How can i drop a database programmatic by closing open connections and check it's ever…
Jalal
  • 6,594
  • 9
  • 63
  • 100
2
votes
2 answers

How to drop many (but not all) tables in one fell swoop?

I have a database with many tables. Twelve of these tables start with the same prefix: mystuff_table_1 mystuff_table_2 mystuff_table_3 mystuff_table_4 etc... I don't want to type DROP TABLE mystuff_table_n CASCADE; over and over again, especially…
tadasajon
  • 14,276
  • 29
  • 92
  • 144
2
votes
1 answer

Django reset not dropping tables

I just migrated my dev environment from Ubuntu Linux to Mac OSX snow leopard. All of this was working on Linux. On both, I have used MySQL for Django's db. Django's reset function is not issuing drop commands for all of my app's models. Here is my…
Neil
  • 7,042
  • 9
  • 43
  • 78
2
votes
0 answers

Liquibase Maven plugin: Getting "table doesn't exist" error when trying to drop all tables

We're using Maven 3.0.4 with the Liquibase 2.0.5 Maven plugin. We have this set up to clear all tables from our test database: org.liquibase
Dave
  • 15,639
  • 133
  • 442
  • 830
2
votes
1 answer

MySQL/PHP drop table not working

I've got a function that has worked very well for parameterizing MySQL queries, but I need it to perform a DROP TABLE IF EXISTS query and I'm not having any luck. I'm not getting any errors but the table is not being dropped and I'm not sure…
Sean Cunningham
  • 3,006
  • 5
  • 24
  • 35
2
votes
2 answers

Is there a MySQL command to implement something like "drop tables except t1,b2"?

I want to keep t1,t2 and drop all other tables.
omg
  • 136,412
  • 142
  • 288
  • 348
1
vote
1 answer

Excel VBA - exec script to drop temp table

I want to drop a # temp table when running then macro, is it correct to use: tempdb..sysobjects The script is: sScript = sScript + "IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE xtype = 'U' AND name like '#vl_enrolledByDate%') " &…
HL8
  • 1,369
  • 17
  • 35
  • 49
1
vote
3 answers

Temporary Table vs Create and Drop Table

I'm creating a table "InterviewTemp" , inserting data there, updating a second table with that data and then dropping the "InterviewTemp" table. there is an example: CREATE TABLE [entrevistasTemp]( [id_usuario] [int] NULL, [id_entrevista]…
grteibo
  • 607
  • 3
  • 11
  • 20
1
vote
1 answer

Drop and recreate a table with data of a Graph DB

This is a follow up question to this question: SQL drop table and re-create and keep data I got a table in a Graph db (inside SQL Server) for which I need to change one of its columns' name and type. Sql server said I need to drop and recreate the…
CodeMonkey
  • 11,196
  • 30
  • 112
  • 203
1
vote
1 answer

Attempted to drop columns containing foreign keys and received error message

I am using phpMyAdmin version 3.3.10.3 to manage my database. I am using InnoDB and foreign key contraints. I have attempted to drop several columns from a table. These columns are foreign keys referencing other tables. ALTER TABLE `product` DROP…
user898750
  • 43
  • 4