I have some SQL code that needs to be executed if a certain View exists in a database. How would I go about checking if the View exists?
EDIT: The DBMS being used is Mic
IN SQL Server ,
declare @ViewName nvarchar(20)='ViewNameExample' if exists(SELECT 1 from sys.objects where object_Id=object_Id(@ViewName) and Type_Desc='VIEW') begin -- Your SQL Code goes here ... end