To check if a table exists in a SQL Server 2008 database, use the following T-SQL code:
Use the system view sys.objects and not the old sql server 2000 system table sysobjects

not exists (select 1 from sys.objects o where =’TableName’ and o.type =’U’)
    create table
dbo.TableName (
Id int identity(1,1) not nullprimary key,
Barcode varchar(35) not null


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.