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
1
vote
4 answers

What happens to an existing DB2 view, if the table is dropped?

If we have created a view on an existing DB2 table and then drop the table. What will happen to the view ?
Rohan
1
vote
4 answers

How can I run a script which is generated from another script under Oracle DB?

Does anybody know how to run all the lines generated from the following query as scripts on their own right? select 'DROP TABLE '||table_name||' CASCADE CONSTRAINTS;' from user_tables; What I'm basically trying to do, is delete all the user tables…
serv-bot 22
  • 1,278
  • 2
  • 10
  • 13
1
vote
1 answer

oracle drop table cascade constraints statement hanging

I'm issuing a simple drop table cascade constraints table , but it is hanging forever. After waiting for hours, if I press the cancel button in the SQL Developer, it says "User cancelled operation" like I'm the culprit. Please advice, before I shoot…
Walking Corpse
  • 107
  • 7
  • 31
  • 49
1
vote
2 answers

Unable to drop database in Postgres

I'm new to databases in general and Postgres in particular. I'm doing something wrong as I'm unable to drop a database. I've searched for similar issues, but it's always someone that has lost or does not know an id/password. In this case the owner…
Treizh
  • 322
  • 5
  • 12
1
vote
1 answer

How do you measure the impact of dropping a schema in Oracle?

I have a aged and redundant schema that I want to drop. Running DROP USER old_schema CASCADE runs succesfully and it's dropped. How can I find out whether dropping this schema results in other components in the database (under different schemas)…
lohithbb
  • 128
  • 1
  • 11
1
vote
0 answers

Does dropping a table drop its dependent trigger?

Dropping a table invalidates dependent objects and removes object privileges on the table. If you want to re-create the table, then you must regrant object privileges on the table, re-create the indexes, integrity constraints, and triggers…
sql_dummy
  • 715
  • 8
  • 23
1
vote
1 answer

How do I dynamically DROP stored procedures and functions using prepared statements (MySQL) -- DROP PROCEDURE LIKE

I've been trying to dynamically drop tables, procedures, and functions in MySQL. I'm doing this because I am dynamically creating them for a project, when the project version changes I need to clean up and rebuild it. I can dynamically drop tables,…
Mark Davich
  • 512
  • 1
  • 5
  • 16
1
vote
1 answer

Sybase SQL Anywhere drop all constraints on a column

Is it possible in SAP Sybase SQL Anywhere 12.0.1 to drop all constrains with a simple and single line of code for a specific column in a table? I know I can get them via sys-tables, but maybe there is some easier way of doing this. Thank you very…
BendEg
  • 20,098
  • 17
  • 57
  • 131
1
vote
1 answer

Does Oracle auto-compress the table as it grows large?

I have a table in my database.Earlier while performing the DROP DDL there was no issue. But after some days as the table become large and i tried DROP DDL it is saying: SQL Error: ORA-39726: unsupported add/drop column operation on compressed…
JManish
  • 321
  • 4
  • 17
1
vote
1 answer

How to redeclare/redefine MySQL User Function every time you refresh?

Is it possible to redeclare a MySQL function every time you refresh, this is my code mysql_query(" DROP FUNCTION IF EXISTS Add_num; CREATE FUNCTION Add_num(LAT_A INT) RETURNS INT READS SQL DATA DETERMINISTIC BEGIN DECLARE Ans BIGINT; SET Ans = LAT_A…
user3741635
  • 852
  • 6
  • 16
1
vote
4 answers

TSQL need to return last day of month only, how do I drop year, month & time?

I am writing a function in T-SQL returning the last day of the month regardless of the date input. Here is my code: Alter Function dbo.FN_Get_Last_Day_in_Month2 (@FN_InputDt Datetime) Returns smalldatetime as Begin Declare @Result …
JMS49
  • 263
  • 1
  • 8
  • 18
1
vote
1 answer

MySQL stored procedure - distinguish between note and error

I have a stored procedure that executes stored SQL. However, the error-handler kicks-in and exits if the user attempts to execute drop temporary table if exists t_person; and 't_person' doesn't exist. I'm perfectly happy to generate an error when…
Tom Melly
  • 98
  • 7
1
vote
1 answer

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-db'

I'm trying to delete a database inside an RDS MySQL instance and I get the following error . Can someone kindly help me resolve this issue [ec2-user@ip-10-10-1-14 ~]$ mysql -h wda2d.cmkridjjwpjp.ap-southeast-2.rds.amazonaws.com -u happy-p Enter…
Rocky
  • 123
  • 3
  • 3
  • 6
1
vote
1 answer

Drop all tables except specific ones

I want to drop all tables except few of them. I am using the following command: mysqldump -uroot -pxxx --add-drop-table --no-data database | grep ^DROP | grep -v "^(cache|webform|redirect)([_a-z0-9]?)+$" | mysql -uroot -pxxx database The regex…
George D.
  • 1,630
  • 4
  • 23
  • 41
1
vote
3 answers

Difference between "DROP COLUMN" and "DROP" keywords in PostgreSQL

I just noticed you can write both in PostgreSQL. Is there any difference or is it just a "simplified" syntax. As far as I know, both of these does exactly the same. ALTER TABLE table DROP my_column; vs ALTER TABLE table DROP COLUMN…
Watercolours
  • 393
  • 1
  • 3
  • 19