Error converting data type nvarchar to int

  • 14 years ago

    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

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - Rick Osborne