Questions tagged [drop-table]

The SQL command for deleting an entire table.

DROP TABLE is used in SQL to remove a table.

152 questions
0
votes
2 answers

SQL drop table errors

I'm trying to create a database for a soccer registration application. I'm trying to keep it simple right now and once I feel comfortable then make it more detailed. I'm trying to run my sql but I keep getting these errors. I was wondering if…
0
votes
0 answers

Can EF code fisrt cause my db to drop all objetcs?

I am using EF6 with existing db and a separate new schema for my code first. We were moving from staging to Production, and suddenly realized that all db's code first objects were gone, all beside the migration table. Of course everybody blamed…
0
votes
0 answers

Why is a specific table becoming un-deletable sporadically?

This is the error that i am getting: - TITLE: Microsoft SQL Server Management Studio Drop failed for Table 'dbo.FIST5$'. (Microsoft.SqlServer.Smo) For help, click:…
0
votes
2 answers

Exception after dropping table

If I execute a procedure that drops a table and then recreate it using 'SELECT INTO'. IF that procedure raises an exception after dropping the table, does table dropping take place or not?
0
votes
1 answer

MySQL: Dropping specific tables from a schema if tablename not found?

I have a information schema of tables, say it contains aaaa_tale bbbb_table cccc_table dddd_table I have another table that contains a list of table names. cccc_table bbbb_table Is there a command I can execute that will allow me to drop the…
brianthelion
  • 33
  • 1
  • 8
0
votes
1 answer

Drop table if it has less than n records

I am experimenting with postgres and can't get this simple query to work: drop table mytable if (select count(*) from mytable)<50 ; This gives error: ERROR: syntax error at or near "if" LINE 1: drop table tablename if (select count(*) from…
goelakash
  • 2,502
  • 4
  • 40
  • 56
0
votes
1 answer

Dropping Referencing and Referenced tables in SQLite

Working with the artist/tracks example at https://www.sqlite.org/foreignkeys.html I'd like to drop both tables. I would think that if I first drop tracks (which References artist) I could then drop artists: stat_5.executeUpdate("drop table if exists…
Ed S
  • 239
  • 5
  • 21
0
votes
0 answers

Why do I get an exception when my client and server apps are accessing the same stored procedure, yet the code still succeeds?

I have a Winforms app that calls a method in a Web API app like so: private async Task SavePlatypusComplianceFileOnServer(string year, string month) { string monthAsMM = ReportRunnerConstsAndUtils.GetMonthAsMM(month); HttpClient client = new…
0
votes
2 answers

Cannot drop a table because of foreign keys

I've been trying to fix this problem for hours now and I have no idea what causes it. I'm trying to drop tables in MSSQL Server (I need to start from scratch) and whenever I'm using the statement DROP TABLE dbo.Manages; I get this message: Could…
Jake
  • 67
  • 3
  • 10
0
votes
2 answers

Deal with dependencies error messages when dropping tables

I need to drop tables that are not used somewhere else in my database (mainly views). I have listed a series of DROP TABLE... commands but I can't run them at once because an error message is issued each time a used table is found. I would need a…
wiltomap
  • 3,933
  • 8
  • 37
  • 54
0
votes
1 answer

Crop database to table and its dependencies

I'm doing some tests on a particular table MyTable, and I need to drop all tables / properties of a database that aren't relevant to MyTable. How would I do that with a script and/or in SQL Server Management Studio (2012)? Disclaimer: This is only…
alksdjg
  • 1,019
  • 2
  • 10
  • 26
0
votes
1 answer

Oracle sequence created twice. ORA-00955: name is already used by an existing object

EDIT After your advices, the code and the errors. I got an error "ORA-00955: name is already used by an existing object" now. The sequences creation create this error each time a DataStoreManager constructor is called. Here is the code now : public…
Csi
  • 526
  • 3
  • 22
0
votes
1 answer

ORA-00933: SQL command not properly ended in Groovy Script

Wrote this script: static void schema() { Sql.newInstance(*DB_CONFIG, DB_DRIVER).execute(''' drop table if exists post; drop table if exists author; create table author( id integer primary key, …
A.E.K
  • 63
  • 1
  • 7
0
votes
1 answer

How to clear or drop Declared table

How do I clear/reset/drop temporary created table that is in loop? Another loop at the top with extra code... How do I reset/drop the declared table up here or below? Declare @Aresource table(idr int identity(1,1), id int) Insert into…
Emil
  • 1
  • 1
0
votes
2 answers

Script with Oracle DROP TABLE in 11gR2

I am little bit confused about my query. I am getting error but it works. I am using ORACLE 11gR2 in command prompt. I have created 2 tables dp (department) and em (employee) with Primary key and foreign key. If I run the script couple of times, the…
Murshed
  • 3
  • 2
  • 2
  • 7