Scramble ntext information

  • Hello Gurus,

    I have a Employee table with Employeemap column with ntext data type which contain

    data like this

    : Empname cheryl Gender M empid: 2333333

    How to replace this information as binary image instead of text.

    Thanks in advance

  • Is possible to do ntext to binary are or not?

  • Au4848 (5/27/2008)


    Is possible to do ntext to binary are or not?

    Not directly. I believe that you have to force it through some intermediate data types first, like:

    Select @img = CAST(CAST(CAST(NtextColumn as nvarchar(max)) as varbinary(max)) as image)

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • I gotta ask... why is the data stored this way? It's mostly "death by SQL" and now you want to compound the problem by converting it to the equivelent of hex?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Jeff that was setup during design time which I'm not sure of it now I need scramble that column as binary instead of text ? Do you have any thoughts on it

  • Sure... Barry is on the right track. Try that.

    I guess I don't need to tell you that the column information stored in the NTEXT column should really be normalized into multiple columns, huh? Good thing I'm not on your team... I'd be looking for that designer... with my favorite slingshot and an extra large bucket of pork chops... every waking minute, too! Man, they messed up that database! And they're making it worse!

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Please tell me that the reason for changing this field to binary is not a half-assed attempt at "encryption"...

    Regards,

    Jacob

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

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