I am getting that error when running the procedure below:
Any ideas what i could be doing wrong?
-----------------------------------------------------------------------------------------
SET
QUOTED IDENTIFIER OFF
GO
SET
ANSI_NULLS ON
GO
IF EXISTS
(SELECT * FROM dbo.sysobjects
WHERE (id=OBJECT_ID(N'[dbo].[Usp_TblBatch_BY_BatchStatusIDBatchTypeIDMaxDownloadDate_SEL]'))
AND (OBJECTPROPERTY(id, N'IsProcedure') =1))
BEGIN
PRINT 'Dropping Procedure Usp_TblBatch_BY_BatchStatusIDBatchTypeIDMaxDownloadDate_SEL'
DROP PROC [dbo].[Usp_TblBatch_BY_BatchStatusIDBatchTypeIDMaxDownloadDate_SEL]
END
GO
PRINT
'Creating Procedure Usp_TblBatch_BY_BatchStatusIDBatchTypeIDMaxDownloadDate_SEL'
GO
CREATE PROCEDURE
[dbo].[Usp_TblBatch_BY_BatchStatusIDBatchTypeIDMaxDownloadDate_SEL]
@BatchStatusID
INT,
@BatchTypeID
INT,
@MaxDownloadDate
DATETIME
AS
SET NOCOUNT ON
SELECT
tblBatchStatus.Id AS BatchStatusID,
tblBatch.batchTypeId
AS BatchTypeID,
tblBatch.DownloadDateTime
AS DownloadDate
FROM
tblBatch WITH (NOLOCK)
JOIN
tblBatchStatus WITH (NOLOCK) ON tblBatchStatus.id = tblBatch.BatchStatusId
JOIN
tblBatchType WITH (NOLOCK) ON tblBatchType.id = tblBatch.BatchTypeId
WHERE
tblBatchStatus.id = @BatchStatusID AND
tblBatchType.id = @BatchTypeID
AND
tblBatch.DownloadDateTime = @MaxDownloadDate
ORDER BY
tblBatch.BatchStatusID
SET QUOTED_IDENTIFIER OFF
GO
SET
ANSI_NULLS ON
GO
GRANT EXEC ON
[dbo].[Usp_TblBatch_BY_BatchStatusIDBatchTypeIDMaxDownloadDate_SEL] to [NIMApp]
GO
Thanks
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).