You can use the OBJECTPROPERTY()
function in SQL Server to find out whether or not an object is a view.
This function accepts two parameters: the object ID, and the property for which you’re checking it for.
Therefore, you can pass the object ID as the first argument, and IsView
as the second, and the function will return either a 1
or a 0
depending on whether or not it’s a view.
A return value of 1
means that it is a view, and a value of 0
means that it’s not.