ViewExists
Updated: 30 October 2008
Use wct.ViewExists to determine if the specified view exists in the database.
Syntax
SELECT [westclintech].[wct].[ViewExists](
<@Schema, nvarchar(4000),>
<@ViewName, nvarchar(4000),>)
Arguments
@Schema
is the name of schema containing the view to test for. @Schema is an expression of the character string data type category.
@ViewName
is the name of view being tested for on the database. @ViewName is an expression of the character string data type category.
Return Types
bit
Remarks
· ViewExists simplifies SQL intended to drop a view if it exists.
Example
IF (wct.ViewExists('wct','myView') <> 0) DROP TABLE wct.myView
Here is the result set
----------------------
Command(s) completed successfully