Encrypt & decrypt coloumn

  • Hi,

    Help me ,

    How to encryt two column in a table

    table name: account

    Fields (ssn int, b_date datetime)

    Is it possible to encrypt int,datetime coumln...

    Thanks

  • using cell encryption it is possible, there are schema changes to the columns to enable this. The data must be encrypted\decrypted as it is written\read from the table.

    This link provides further details

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Could you give any example for encrypt & decrypt two column in a table ( ssn int, b_date datetime)

    i'm going to implement in production server..

    Thanks

  • This link provides further details[/quote]

  • you have a pretty wide array of encryption choices, but as Perry Whittle mentioned, they require a schema change...you'll need to change a varchar column to varbinary, for example using the encryption below.

    here's a basic example; it should be obvious that you can encrypt each column you want to protect individually from there:

    --http://www.databasejournal.com/features/mssql/article.php/3714031/SQL-Server-2005-Encryption-types.htm

    -- EncryptByPassPhrase(@password,@DataToEncrypt )

    select EncryptedData = EncryptByPassPhrase('NotMyRealPhraseKey', '123456789' )

    -- DecryptByPassPhrase(@password,@DataToDecrypt )

    declare @val varbinary(max)

    SET @val = 0x01000000DCE1DCC7E4F8710C513B48D4639F089F5035AB5DEEDCD10DCEF00F929A3F678D

    select convert(varchar(100),DecryptByPassPhrase('NotMyRealPhraseKey',@val))

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • solomon.jernas (7/15/2011)


    Could you give any example for encrypt & decrypt two column in a table ( ssn int, b_date datetime)

    I did in the link above 😉

    It's a case of RTFM

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • solomon.jernas (7/15/2011)


    Could you give any example for encrypt & decrypt two column in a table ( ssn int, b_date datetime)

    i'm going to implement in production server..

    Thanks

    I hope you do thorough testing first.

    We use xpcrypt

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply