SQL Server judges various non-existent

Source: Internet
Author: User

Determine if the database exists if exists (SELECT * from dbo.sysobjects WHERE name = ' database name ')

--drop database [DB name]

Determine if the table exists if exists (SELECT * from dbo.sysobjects WHERE id = object_id (n ' [table name] ') and OBJECTPROPERTY (ID, n ' isusertable ') = 1)

--drop table [table name]

Determine if the stored procedure exists if exists (SELECT * from dbo.sysobjects WHERE id = object_id (n ' [Stored procedure name] ') and OBJECTPROPERTY (ID, n ' isprocedure ') = 1)

--drop procedure [Stored procedure name]

Determine if the function exists if object_id (N ' function name ') is not NULL DROP function dnt_split

Determine if the database is open full-text Search select Databaseproperty (' Database name ', ' isfulltextenabled ')

To determine if a full-text catalog exists select * FROM sysfulltextcatalogs where name = ' Full-text catalog name '

< Span style= "color: #494949; Font-family:simsun; font-size:14px; line-height:21px; Background-color: #f5f2ef ">

SQL Server determines a variety of non-existent

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.