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

Temporary table will not drop

The conditional drop table line in the code below doesn't seem to work. It executes without error, but then the next line errors saying the object ID already exists - so it's not actually dropping the table. Any ideas? I'm connecting to an MS SQL…
CBRF23
  • 1,340
  • 1
  • 16
  • 44
0
votes
2 answers

MySQL and PHP DROP TABLE based on value in table

I have a database where entries are inserted into tables with a timestamp (an int from PHP's time() not an SQL timestamp). I want to make a query to drop all tables where the greatest timestamp is less than the expiry time (some time from the time…
DankMemes
  • 2,085
  • 2
  • 21
  • 30
0
votes
1 answer

How to drop #Temp_______hex tables?

Our Temp DB has grown very large and we'd like to clean it up. When i open the tempdb, temptables folder, I notice a like of tables named like so: #Somename________hexcode #Someothername________hexcode etc... we know we can delete them because…
A.G.
  • 2,089
  • 3
  • 30
  • 52
0
votes
1 answer

Prevent drop table if conditions are not met

I'd like to ask if it is possible to handle dropping table command and break it if some conditions are not met?
John Smith
  • 173
  • 2
  • 10
0
votes
1 answer

Dropping Tables within an AFTER INSERT Trigger

I am looking for suggestions on how to handle incoming data from a C# client app that sends via System.Data.SqlClient.SqlBulkCopy. The original intent was to maintain all data sent via the app into our sql server where the data would be 'massaged'.…
ShaneLS
  • 466
  • 6
  • 14
0
votes
2 answers

Create and Drop table everyday

My Customer want to create new table everyday, e.g. MyTable, and then my application will read this table and do some cross-check. After done all cross-check, I need to drop this table. Every day will be create and drop table. Is it good…
Sh4m
  • 1,424
  • 12
  • 30
0
votes
1 answer

Count of DROP Statements Executed for sp_MSforeachtable

Am dropping all the table names in DB using EXEC sp_MSforeachtable 'DROP TABLE ?' Is there a way i can get count on number of tables dropped. Thanks, Peru
user2067567
  • 3,695
  • 15
  • 49
  • 77
0
votes
0 answers

SQLplus not executing CREATE TABLE statements anymore

SET TERMOUT ON PROMPT Building Hotel tables. Please wait. --SET TERMOUT OFF DROP TABLE BD; DROP TABLE BR; DROP TABLE D; DROP TABLE R; CREATE TABLE RT (TYPE VARCHAR2(11) NOT NULL, RATE NUMBER(6,2), CONSTRAINT roomtype_pk PRIMARY…
Hoody
  • 2,942
  • 5
  • 28
  • 32
0
votes
2 answers

Advantages and disadvantages of using delete from vs. copying the data and using drop

The MySQL queries delete from t where not condition; and create table s select * from t where condition; drop table t; are very similar. (Here, condition in the one query is the same as condition in the other.) One advantage of the second…
msh210
  • 256
  • 6
  • 23
0
votes
1 answer

how to solve this- Cannot delete or update a parent row: a foreign key constraint fails

I'm trying to drop table and I'm getting this error : Cannot delete or update a parent row: a foreign key constraint fails Some could help me please : the statement : DROP TABLE vehiculo the error : #1217 - Cannot delete or update a parent row:…
user2132046
  • 95
  • 1
  • 2
  • 7
-1
votes
1 answer

Union tables with same prefix in postgresql

I have number of tables with prefix "tb_" in a schema (not public) in postgres database. I want to create a new table as union of all these tables with prefix "tb_". All the tables have same structure and no duplicates. I could do it manually using…
Jio
  • 578
  • 3
  • 8
  • 27
-1
votes
1 answer

JDBC drop table, view, function procedure from Oracle Database

I want to drop specified oracle tables, views, procedures and functions via Java JDBC Code. For example, Suppose I've tables T1, T2, T3. Views V1, V2, V3. Procedure P1, P2, P3 and functions F1, F2, F3. How can I delete these Tables, Views,…
-1
votes
1 answer

how to create new rails generator for dropping a table

I creating an app that needs to be able to create and drop tables on the fly, on create it's pretty simple I use: rails g model User name:string but there is no generator for dropping a table. I want to make it be possible to: rails g migration…
-1
votes
1 answer

Trying to drop the table getting error in Oracle

I am just trying to drop the table but getting error. I have just created hbm files of it and checkin the code now that server has been started pointing to the same db. Looks to session got locked. I am getting below error. Error starting at line 1…
Vimal Panchal
  • 301
  • 1
  • 5
  • 15
-1
votes
1 answer

SQL Server : cannot drop table

I try to drop all the foreign and primary keys for an assignment, but so far I get the following error: Msg 3728, Level 16, State 1, Line 3 'fk_DEPENDENT_ESSN' is not a constraint. Msg 3727, Level 16, State 0, Line 3 Could not drop…
Lin Wei
  • 87
  • 1
  • 5
1 2 3
10
11