Questions tagged [drop-table]

The SQL command for deleting an entire table.

DROP TABLE is used in SQL to remove a table.

152 questions
3
votes
1 answer

SQL Error: There is already an object named 'TPatients' in the database

I cannot seem to figure out why I am getting the following error: Msg 2714, Level 16, State 5, Line 56 There is already an object named 'TPatients' in the database. Msg 1750, Level 16, State 1, Line 56 Could not create constraint or index. See…
Thast16
  • 87
  • 1
  • 5
3
votes
1 answer

Redshift: TRUNCATE TABLE IF EXISTS

It is recommended to use TRUNCATE TABLE instead of DELETE. However, truncate table does not support the IF EXISTS clause. The alternative is to DROP TABLE and recreate but needs DDL. Is there a way to do TRUNCATE TABLE if only the table exists?
Gatis Seja
  • 87
  • 2
  • 2
  • 7
3
votes
1 answer

Double loop with drop table in MSSQL

I've while loop inside while loop and both loops do some modifications of one table. I receive an error that table already exists. Below simple example of this problem. Could someone clarify why this doesn't work? I know how to bypass this problem…
Tomek Tarczynski
  • 2,785
  • 8
  • 37
  • 43
3
votes
1 answer

Why would dropping a table in Cassandra take many minutes?

When I delete a table in Cassandra, it takes close to forever. From what I can see, this is because it first creates a snapshot of the table. However, what I do not understand is that they say the snapshot is done by creating a hard link with Copy…
Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
3
votes
3 answers

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

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: …
Ravi
  • 30,829
  • 42
  • 119
  • 173
3
votes
2 answers

SQL Server : drop table with SQL parameters

I'm trying to drop a table using SqlParameters. I have this code . dbCon.Open(); DataRowView d= (DataRowView) cmbTabele.Items[cmbTabele.SelectedIndex]; string name = (d["table_name"]as string); SqlCommand com=new SqlCommand("drop table @nume ",…
user3052078
  • 487
  • 1
  • 8
  • 20
3
votes
4 answers

Drop table in Stored Procedure not working properly?

I have a stored procedure which drops a table if it exists, then it re-creates the table & fills it with relevant data, a friend of mine has about the same code, the only real difference is in the column headers for the table. As an illustration,…
Yorrick
  • 377
  • 2
  • 8
  • 28
3
votes
3 answers

Teradata DELETE ALL vs DROP+CREATE

I've been recently assigned on a project using Teradata. I've been told to strictly use DROP+CREATE instead of DELETE ALL, because the latter "leaves some space allocated someway". This is counter-intuitive to me, and I think it's probably wrong. I…
agdev84
  • 151
  • 1
  • 5
3
votes
1 answer

Cannot drop a mysql table

I am getting a weird error. I have a table animals, that I am trying to drop. I cannot drop the table because of a foreign key constraint fails. I know that I must drop the foreign keys before I drop the table. The problem is this table has no…
wesleywmd
  • 605
  • 1
  • 6
  • 20
3
votes
3 answers

Drop Empty Partition. Are indexes marked as invalid?

I want to drop a partition that is empty but I am aware about oracle setting all indexes to unusable whenever you perform a partition DDL statement like DROP, therefore, I should add UPDATE GLOBAL INDEXES to the statement though it looks…
Mario Corchero
  • 5,257
  • 5
  • 33
  • 59
3
votes
2 answers

Form has my table locked down tight even after docmd.close

Sorry for the wall of text guys but this one requires expliaining, way too much code to post... I'm importing fixed width files into access in methods that require data entry. I import the file using transferText into two specs (ones global, the…
Mohgeroth
  • 1,617
  • 4
  • 32
  • 47
3
votes
3 answers

mysql drop table and cascade delete to all references to the table

I'm developing a new system from an old system. The new system is using MySQL and java. I want to start with a reduced number of tables. When I delete a table lets say X, how can I cause all references to X to be deleted as well, so if table Y…
melutovich
  • 372
  • 1
  • 3
  • 15
2
votes
2 answers

Oracle - Unable to drop tables

This question is related to the one I posted yesterday but with further implications. The situation is: I'm unable to drop ANY table. Here's an example: SQL> CREATE TABLE FOO (BAR NUMBER) TABLESPACE SYSTEM / Table created. SQL> SELECT COUNT(1)…
jpaires
  • 355
  • 6
  • 13
2
votes
1 answer

Drop_table problem preventing rake db:migrate

I was looking for a way to drop a table in Rails and start fresh and came across this answer: Rails DB Migration - How To Drop a Table? However, when I ran drop_table :examples I got the following error: -bash: drop_table: command not found Here's…
tvalent2
  • 4,959
  • 10
  • 45
  • 87
2
votes
1 answer

Is it ok to drop a 99G mysql table without effect?

I want to drop a 99G mysql table A, table A is useless now, Is it ok to execute the cmd 'drop table A'.I wish no effect on other table's operations.
grey
  • 25
  • 1
  • 4
1 2
3
10 11