DROP TABLE IF EXISTS” in Oracle and SQL Server
2013-07-29 12:41
951 查看
“DROP TABLE IF EXISTS” in Oracle and SQL Server
In MySQL it is pretty easy to drop a table if it exists already. In Oracle and Microsoft’s SQL Server it is a little more complicated. Today I want to present you the solutions for these two DBMS’.
MySQL:
Oracle:
SQL Server:
In MySQL it is pretty easy to drop a table if it exists already. In Oracle and Microsoft’s SQL Server it is a little more complicated. Today I want to present you the solutions for these two DBMS’.
MySQL:
DROP TABLE IF EXISTS [table_name]
Oracle:
BEGIN EXECUTE IMMEDIATE 'DROP TABLE [table_name]'; EXCEPTION WHEN OTHERS THEN NULL; END;
SQL Server:
IF EXISTS ( SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '[table_name]') DROP TABLE [table_name]
相关文章推荐
- “DROP TABLE IF EXISTS” in Oracle and SQL Server
- DROP TABLE IF EXISTS” in Oracle and SQL Server
- add column for a table if this column not exists using T-SQL in SQLServer
- Oracle database does not have a "drop table if exists" clause
- [优秀英文技术文章转载]Table Value Parameters in SQL Server 2008 and .NET (C#)
- to create table if table do not exist -- to backup and restore table in oracle
- SqlServer IF Exists([database]|[table]|[prop]) / Column([Operation])
- Using NOLOCK and READPAST table hints in SQL Server
- Loop and Temp Table usage in SQL SERVER
- use ROW_NUMBER() for pagination in Oracle and SQLServer
- if exists table drop table ORACLE 存储过程
- Oracle Drop Table If Exists
- Check if a database or table exists using Sql Server 2005
- SQL in ORACLE and SQL Server
- SQL trace, 10046, trcsess and tkprof in Oracle 10g(转)
- Get XML tree format based on the tree data in SQL server table
- sql: MySQL and Microsoft SQL Server Stored Procedures IN, OUT using csharp code
- How to setup linked servers for SQL Server and Oracle 64 bit client
- What is Index and how it works in SQL Server?
- Special Table Types In SQL Server