I need to check if a table in SQL exist or not.
If not it must create one automatically.
Now I researched and found this code:
IF NOT EXISTS (SE
object_id = OBJECT_ID(N'[dbo].[YourTable]')
object_id is the column name in sys.objects
OBJECT_ID is a function that returns the ID for the object you specify, i.e. YourTable.
You are comparing the object_id of YourTable with the object_id column in the sys.objects table. You need to replace YourTable with the table name you want to check already exists.