Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encryption
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Encryption
Miscellaneous
Thread ID:
01033938
Message ID:
01033938
Views:
59
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
Map
View

Click here to load this message in the networking platform