USE [Vertragsverwaltung_20160404] GO /****** Object: StoredProcedure [dbo].[dt_getobjwithprop] Script Date: 02.12.2016 09:08:54 ******/ DROP PROCEDURE [dbo].[dt_getobjwithprop] GO /****** Object: StoredProcedure [dbo].[dt_getobjwithprop] Script Date: 02.12.2016 09:08:54 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO /* ** Retrieve the owner object(s) of a given property */ create procedure [dbo].[dt_getobjwithprop] @property varchar(30), @value varchar(255) as set nocount on if (@property is null) or (@property = '') begin raiserror('Must specify a property name.',-1,-1) return (1) end if (@value is null) select objectid id from dbo.dtproperties where property=@property else select objectid id from dbo.dtproperties where property=@property and value=@value GO