-1

Can anyone explain this to me ?

IF OBJECT_ID('tempdb..#RH') IS NOT NULL DROP TABLE #RH 
IF OBJECT_ID('tempdb..#TERM') IS NOT NULL DROP TABLE #TERM 
IF OBJECT_ID('tempdb..#CLRIS') IS NOT NULL DROP TABLE #CLAERIS

What does this code mean

OBJECT_ID('tempdb..#CLAERIS')

Is it mandatory to mention this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Xaaz
  • 3
  • 3
  • 2
    Reading the documentation always helps : https://learn.microsoft.com/en-us/sql/t-sql/functions/object-id-transact-sql?view=sql-server-ver15 – Sebastien F. Mar 12 '20 at 16:38

1 Answers1

1

As mentioned here OBJECT_ID() returns the internal ID from the sys.objects catalog.

Basically the code checks if the temporary table exists and if yes, the table gets dropped.

JollyRoger
  • 329
  • 1
  • 7