1. By using the OBJECT_ID() function
If OBJECT_ID('my_table', 'U') is not null
BEGIN
print 'my_table Table exists'
END
2. By using the INFORMATION_SCHEMA.TABLES
If exists (SELECT * FROM INFORMATION_SCHEMA.TABLES Where table_name = 'my_table')
BEGIN
print 'my_table Table exists!'
END
3. By using sys.Objects Catalog view
If exists(Select * from sys.objects where object_id = OBJECT_ID('my_table') and type = 'U')
BEGIN
print 'my_table Table exists!'
END
Read: https://docs.microsoft.com/en-us/sql/relational-databases/system-information-schema-views/system-information-schema-views-transact-sql?redirectedfrom=MSDN&view=sql-server-ver15
More Posts related to HowTos,
- [Fix] Error 1020 Cloudflare: Access was denied
- What is an Authorization Code Grant? OAuth 2.0
- Fix: psql: error: connection to server at localhost (::1) port 5432 failed: FATAL: database does not exist
- 100+ SEO Tips to improve your website search ranking
- How to submit website to dmoz directory
- How to check the version of NodeJS installed
- How to enter Rockstar Activation Code?
- Background task activation is spurious error - Windows 10, Office 2016, Office 365
- Angular CLI ng Error: You need to specify a command before moving on. Use --help to view the available commands
- cURL HTTP GET request command examples
- Fix - JioCinema Something Went Wrong Please Try Again Error 8001 while streaming IPL Cricket Live
- How to remove password from pdf file
- How to identify the version of IntelliJ
- Command: How to scp a file to remote server location?
- How to add Widgets to MacBook Desktop
- Setting up RSS feeds notifications within Outlook
- Fix - Website Connection timed out Error Code 522 (Cloudflare)
- How to fix: Please check your network connection (Retry)
- Fix: Could not connect to Redis at 127.0.0.1:6379: Connection refused
- Accept Only 0-9 Numbers RegEx Example
- How to create a New Project in Visual Studio Code (VS Code)
- Top 10 emerging breakthrough trending technologies
- Free Unlimited Calls from MTNL & BSNL Landlines from 1st May 2015
- [Error] zsh: command not found: mvn
- How to Scan iPhone for Virus? Is Antivirus it really required?
More Posts:
- How to change Android Button Color using xml attribute and programatically using java - Android
- How to add NewLine Character in Bash Script String - Bash
- How to Enable Java JDK 21 Preview Features on IntelliJ - Java-JDK-21
- Java 8 Leap year check using Year class from java.time api - Java
- How to Open Notepad as Administrator on Windows 11 - Windows
- Fix PowerShell - .ps1 cannot be loaded because running scripts is disabled on this system - Powershell
- Convert Map to List in Java 8 using Stream API - Java
- Xcode 13 - unknown error compiling for iOS 15.0 but module has a minimum deployment target of iOS 15.2 - iOS