Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Error: String or binary data would be truncated

Author  Topic 

PeterG
Posting Yak Master

156 Posts

Posted - 2003-01-28 : 14:33:34
Server: Msg 8152, Level 16, State 6, Line 46
String or binary data would be truncated.
The statement has been terminated.

This is my SP. The error is in the insert statement line. I get the error when I execute this on Sql Query analyzer.

CREATE PROCEDURE dbo.SelectStatementCycleDataPGG
@txtAccountNumber as nvarchar(16),
@dteStartDate as datetime,
@Fixed as datetime,
@profID varchar(10)
AS

Create table #tempTransactions
(lngIndex int IDENTITY,
txtAccountNum varchar(16),
txtCompanyNum varchar(10),
dtePostDate datetime,
dteCycleDate datetime,
dteTransacDate datetime,
txtMerchantName varchar(25),
txtSourceCurr varchar(2),
txtBillingCurr varchar(4),
curForeignAmnt money,
txtSic varchar(6),
curTransacAmnt money,
txtTransacCode varchar(2),
txtMerchantCity varchar(30),
txtMerchantProv varchar(30),
txtMemoFlag varchar(3),
lngParent int,
txtCostCenter varchar(80),
curOrigAmnt money,
curGst money,
lngSourceId int,
curPst money,
blnForeignEx bit,
curNetAmnt money,
blnSent bit,
blnMatched bit,
txtComments varchar(255),
txtDescription varchar(25),
lngLength int,
lngStartPos int
)

Insert Into #tempTransactions
(txtAccountNum, txtCompanyNum, dtePostDate, dteCycleDate, dteTransacDate, txtMerchantName, txtSourceCurr, txtBillingCurr, curForeignAmnt, txtSic, curTransacAmnt,
txtTransacCode, txtMerchantCity, txtMerchantProv, txtMemoFlag, lngParent, txtCostCenter, curOrigAmnt, curGst, lngSourceId, curPst, blnForeignEx, curNetAmnt,
blnSent, blnMatched, txtComments)
SELECT Transactions.txtAccountNum,
Transactions.txtCompanyNum, Transactions.dtePostDate,
Transactions.dteCycleDate, Transactions.dteTransacDate,
Transactions.txtMerchantName, Transactions.txtSourceCurr,
Transactions.txtBillingCurr, Transactions.curForeignAmnt,
Transactions.txtSic, Transactions.curTransacAmnt,
Transactions.txtTransacCode, Transactions.txtMerchantCity,
Transactions.txtMerchantProv, Transactions.txtMemoFlag,
Transactions.lngParent, Transactions.txtCostCenter,
Transactions.curOrigAmnt, Transactions.curGst,
Transactions.lngSourceId, Transactions.curPst,
Transactions.blnForeignEx, Transactions.curNetAmnt,
Transactions.blnSent, Transactions.blnMatched,
Transactions.txtComments
FROM Transactions
WHERE (Transactions.txtAccountNum = @txtAccountNumber) AND
((dteCycleDate = @dteStartDate) or (dteCycleDate = @Fixed) or (dteCycleDate is NULL))
order by dteTransacDate,lngParent, lngIndex

Select * from #tempTransactions
Drop table #tempTransactions
GO


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-01-28 : 14:41:36
You're getting the error because the column isn't big enough for the data that you are trying to insert. Make the column bigger.

Go to Top of Page
   

- Advertisement -