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
4
votes
3 answers

How to drop all tables in db2

I want to drop all tables in db2 database with foregin keys, without drop and recreating.
Roman Iuvshin
  • 1,872
  • 10
  • 24
  • 40
4
votes
1 answer

How do you drop a column with an unamed default value constraint and unknown indexes

What is a method of determining if there is a default constraint on a column and its name, and the names of any indexes in order to drop them before dropping the column?
avenmore
  • 2,809
  • 3
  • 33
  • 34
4
votes
3 answers

MySQL drop table

I want to drop a table with drop table EMPLOYEE; but I get the error: #1217 - Cannot delete or update a parent row: a foreign key constraint fails I looked around on the internet to show the hidden constraints and found: CREATE TABLE `EMPLOYEE`…
AL90
  • 43
  • 1
  • 1
  • 5
3
votes
1 answer

If foreign key exists, drop it

I have a table that has a foreign key relation with another table. I want to check that if this relation exists, drop it. How to I write this query. Thanks.
Tavousi
  • 14,848
  • 18
  • 51
  • 70
3
votes
3 answers

SQL. Changes require the table to be recreated

There is a table full which contains data. Is it possible to change field from [not null] to [null] without dropping and recreating it? SQL writes that table have to be dropped and recreated. :)
Anton Lyhin
  • 1,925
  • 2
  • 28
  • 34
3
votes
1 answer

ANT task running SQL script with configurable database name

I'm trying to create an ANT task that takes some database properties and executes a MYSQL script. For a specific database, it's working fine, and what I have is the following: A configurable properties…
Endo
  • 363
  • 1
  • 6
  • 20
3
votes
1 answer

Orphan constraints in SQL Server database

Running the following query results in all constraints in our client's database. However, several rows in the result set don't seem to have a parent, i.e. parent_object_id = 0 and OBJECT_NAME(parent_object_id) returns NULL. SELECT name, type_desc,…
bernhof
  • 6,219
  • 2
  • 45
  • 71
3
votes
7 answers

Drop tables that are not in a list?

I need to drop about 20k tables. I know the names of the tables that are NOT to be dropped. If I have table names "a,b,c,d,e,f,g...", how can I drop all tables that are not in the list "a,b,c"?
llaskin
  • 789
  • 2
  • 9
  • 24
3
votes
4 answers

MySQL Dropping Tables

What syntax for MySQL would I use to drop multiple tables that have a similar pattern to them? Something like: DROP TABLES FROM `Database1` LIKE "SubTable*"
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
3
votes
2 answers

SQLPlus is trying to drop package twice

While executing scripts in SQLPlus I've encountered a problem: script.sql contains the following lines @some_pkg.pks @some_pkg.pkb drop package some_pkg; / After calling > sqlplus user/password@dbname @script.sql the following messages are in…
user4298563
3
votes
4 answers

ORACLE :Are grants removed when an object is dropped?

I currently have 2 schemas, A and B. B has a table, and A executes selects inserts and updates on it. In our sql scripts, we have granted permissions to A so it can complete its tasks. grant select on B.thetable to A etc,etc Now, table 'thetable'…
Tom
  • 43,810
  • 29
  • 138
  • 169
3
votes
4 answers

database table will not drop (or show it's inputed data)

if i apply a sql query statement to this table "select * from context.tablename", all i see is the "Executing query.." message and nothing else hapens. I also can not truncate or drop this table. It prevents me from even dropping vhole database. Is…
dani
  • 469
  • 3
  • 12
  • 23
3
votes
2 answers

DROP All Views PostgreSQL

How I can Delete All User Defined Views From PostgreSQL using a Query? Like we can delete All functions using query : SELECT 'DROP FUNCTION ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ');' FROM pg_proc INNER…
Satish Sharma
  • 3,284
  • 9
  • 38
  • 51
3
votes
2 answers

How can I drop all the views from a MYSQL Database?

My database had lots of views and it was impossible to drop them one by one. I would like to just drop them all because the database doesn't refresh structure changes of the tables in the view that select from them.
Fernando Camargo
  • 3,085
  • 4
  • 30
  • 49
3
votes
1 answer

Checking what 'DROP' queries were ran on SQL Server

Some one keeps dropping tables on one of our database's as soon as I gain access the server. I don't know who this some one is. I have nearly lost my job once because of this person. So I was wondering is there a way I can check which user ran a…
Jacques Koekemoer
  • 1,378
  • 5
  • 25
  • 50