• should become

    case data_type

    when 'float' then 'cast([' + column_name + '] as decimal(38, 10))'

    when 'ntext' then 'cast([' + column_name + '] as nvarchar(max))'

    when 'text' then 'cast([' + column_name + '] as varchar(max))'

    else '[' + column_name + ']'

    end + ' as varbinary(max))), ''null'')'

    Oleg, in case of type text what is the difference from the first version ?

    I have a text column with 300000 special characteres of length and doesn't worked with your procedure.

    Through the option generate scripts from SSMS 2012 it's ok, but usually i always use your script however in this table doesn't worked with text column because a lot of special characters. I think the problem is the lost of data when cast to hexa .. i don't know .

    Thanks a lot for your proc.

    Alexandre Araujo