Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run t
  • hi all i am making stored procedure for insert data but i am facing this error in stored procedure 

    Msg 257, Level 16, State 3, Procedure InsertChequeSeries, Line 34
    Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.


    my procedure code is


    Create PROCEDURE [dbo].[InsertChequeSeries]

    @SeriesId int output,
    @SeriesNo as varchar(15) output,
    @BankId as datetime,
    @SlipNoFrom as varchar(1),
    @SlipNoTo as varchar(15),
    @BranchCode as int,
    @Posted as bit,
    @AddedBy as int,
    @AddedOn as datetime,
    @AddedIpAddr as varchar(50)

    AS

    --select * from ChequeSeries

    set @SeriesNo = (Select ISNULL(Max(SeriesNo),0)+1 from ChequeSeries Where BranchCode=@BranchCode)


    INSERT INTO ChequeSeries
           (SeriesNo, BankId, SLipNoFrom, SlipNoTo, BranchCode, Posted, AddedBy, AddedOn, AddedIpAddr)

    SET @SeriesId = @@Identity


  • 1 Comment sorted by
  • Vote Up0Vote Down farazfaraz
    10.00 Karma Accepted Answer
    may be you are trying to insert datetime data into integer column and as i notice your stored procedure your

    this line

    @BankId as datetime,

    should be convert in this

    @BankId as int,

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

    Optimum Creative