zimmer9
asked on
When I execute a stored proc with input parms using SQL Server 2008, I get the following error msg: Msg 8152 String or binary data would be truncated. Do you know how I can resolve this?
I created a stored procedure as follows:
When I create it I get the following message: Command(s) completed successfully.
However, when I execute it with the following input parms as follows:
exec proc_CSL_Load_ImportMonthl yChecks '0115', '5500', 479.58, '10/21/2016', '01/18/2017', 'git3jz'
I get the error:
Msg 8152, Level 16, State 14, Procedure proc_CSL_Load_ImportMonthl yChecks, Line 5
String or binary data would be truncated.
The statement has been terminated.
Do you know how I can resolve this error?
USE [CSL]
GO
/****** Object: StoredProcedure [dbo].[proc_CSL_Load_Impor tMonthlyCh ecks] Script Date: 01/18/2017 09:59:40 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROC [dbo].[proc_CSL_Load_Impor tMonthlyCh ecks]
@strBank varchar(4), @Amt1 varchar(11), @Amt2 numeric(9,2), @dtFileDate nvarchar(10),
@dtImportDate nvarchar(10), @strImportBy varchar(50)
AS
INSERT INTO dbo.tbl_CSL_ImportMonthlyC hecks (bankname, banknumber, amt1, amt2,
datefile, dateimported, importedby, branch)
SELECT bankDescr, bankAcctNum, @Amt1, @Amt2,
@dtFileDate, @dtImportDate, @strImportBy, '2'
FROM dbo.tbl_CSL_Bank
WHERE bankID = @strBank
The table layouts are as follows:
tbl_CSL_Bank
bankID (PK, varchar(4), not null)
bankDescr (varchar(50), not null)
status (varchar(50), not null)
entity (varchar(50), not null)
bankAcctNum (varchar(15), not null)
tbl_CSL_ImportMonthlyCheck s
bankname (varchar(50),null)
banknumber(varchar(4), not null)
amt1(varchar(11), not null)
amt2(numeric(19,2) not null)
datefile(varchar(10), not null)
dateimported(varchar(10), not null)
importeby(varchar(50), not null)
branch(varchar(50), not null)
When I create it I get the following message: Command(s) completed successfully.
However, when I execute it with the following input parms as follows:
exec proc_CSL_Load_ImportMonthl
I get the error:
Msg 8152, Level 16, State 14, Procedure proc_CSL_Load_ImportMonthl
String or binary data would be truncated.
The statement has been terminated.
Do you know how I can resolve this error?
USE [CSL]
GO
/****** Object: StoredProcedure [dbo].[proc_CSL_Load_Impor
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROC [dbo].[proc_CSL_Load_Impor
@strBank varchar(4), @Amt1 varchar(11), @Amt2 numeric(9,2), @dtFileDate nvarchar(10),
@dtImportDate nvarchar(10), @strImportBy varchar(50)
AS
INSERT INTO dbo.tbl_CSL_ImportMonthlyC
datefile, dateimported, importedby, branch)
SELECT bankDescr, bankAcctNum, @Amt1, @Amt2,
@dtFileDate, @dtImportDate, @strImportBy, '2'
FROM dbo.tbl_CSL_Bank
WHERE bankID = @strBank
The table layouts are as follows:
tbl_CSL_Bank
bankID (PK, varchar(4), not null)
bankDescr (varchar(50), not null)
status (varchar(50), not null)
entity (varchar(50), not null)
bankAcctNum (varchar(15), not null)
tbl_CSL_ImportMonthlyCheck
bankname (varchar(50),null)
banknumber(varchar(4), not null)
amt1(varchar(11), not null)
amt2(numeric(19,2) not null)
datefile(varchar(10), not null)
dateimported(varchar(10), not null)
importeby(varchar(50), not null)
branch(varchar(50), not null)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.