Skip navigation

How can I check with SQL whether a table is already there or not?

A. Two methods :-

1. If object_id('tbl_name') is not null

2. if exists (select * from sysobjects where id = object_id('tbl_name') and sysstat & 0xf = 4)

TAGS: SQL Server
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.