-- step  3. create procedures
Use FlowingExampleWithTriggers
Go

IF EXISTS (select * from dbo.sysobjects where id = object_id(N'[dbo].[spMatchInsert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[spMatchInsert]
GO

CREATE PROCEDURE [dbo].spMatchInsert
      @parameter1 nvarchar(max),
	  @parameter2 bigint,
	  @parameter3 nvarchar(max)
WITH EXECUTE AS CALLER
AS
EXTERNAL NAME SqlServerDataladderIntegration.StoredProcedures.spMatchAndInsertInCache
Go


IF EXISTS (select * from dbo.sysobjects where id = object_id(N'[dbo].[spAddToCacheTable]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[spAddToCacheTable]
GO
CREATE PROCEDURE [dbo].spAddToCacheTable
      @parameter1 nvarchar(max),
	  @parameter2 nvarchar(max)
WITH EXECUTE AS CALLER
AS
EXTERNAL NAME SqlServerDataladderIntegration.StoredProcedures.spAddRecordToCache
Go

IF EXISTS (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetSeparator]') and OBJECTPROPERTY(id, N'IsScalarFunction') = 1)
DROP FUNCTION [dbo].[spGetSeparator]
GO

CREATE FUNCTION [dbo].[spGetSeparator]()
RETURNS 
   nvarchar(max) 
WITH EXECUTE AS CALLER
AS 
EXTERNAL NAME SqlServerDataladderIntegration.UserDefinedFunctions.spGetSeparator
