General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Hi All,
I am trying to encrypt a credit card field in my account table. The ccNum filed is varchar(20) bit long. Below is my code:
declare @cardNumber2 varchar(180) ,
@cardNumber varchar(180)
set @cardNumber2 = (Select ccpono from accounts where accntid = 1)
Set @CardNumber = (Select ccpono from accounts where accntid = 1)
Set @CardNumber = char(39) + Rtrim(@CardNumber) + char(39)
exec master..xp_repl_encrypt @cardNumber output
Update Accounts
Set ccpono = @cardNumber
where accntid = 1
I get the following error when I execute my code.
Error
Server: Msg 8152, Level 16, State 9, Line 17
String or binary data would be truncated.
The statement has been terminated.
Any idea how to solve the issue?
Thansk
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only