SQL Server Performance

Update Column Value with Function - How?

Discussion in 'SQL Server 2005 General Developer Questions' started by sqlderby, Apr 7, 2010.

  1. sqlderby Member

    Hi All

    In a table we need to update data value in a column. To encrypt the data of this column. We have a function that encrypt the data.

    SELECT fn_generate_enrypt(CardNo) - where CardNo is name column in the table.

    So we need to update previous data in this table in one go by using this function and <= <ID> column values. I don't know that how update previous data values of column by using this function.
    Or create dynamic select statement from table for each data values from this column as if run the function like this...
    SELECT fn_generate_enrpt(1222233334444) then it's work...

    Pl help here as it is urgent.

    Thanks in Advance.
  2. FrankKalis Moderator

    Have you already tried a
    UPDATE Table
    SET CardNo = your_function(CardNo)
    WHERE <some fancy condition>
    ?
  3. Madhivanan Moderator

    Just for information, you may need to qualify the function name with object owner when you use the above code

Share This Page