User Tools

Site Tools


microsoft:microsoft_sql_server:sql:check_object_exists

Microsoft - Microsoft SQL Server - SQL - Check Object Exists

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SomeTable$Some Doc]') AND TYPE IN (N'U'))
  UPDATE[SomeTable$Some Doc]
  SET ...

Alternatively

IF EXISTS (SELECT 1 FROM SomeTable WHERE Name = 'somename')
microsoft/microsoft_sql_server/sql/check_object_exists.txt · Last modified: 2022/07/01 07:58 by 45.89.242.205

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki