We have a system with proprietary algorithm that converts the data entered in an user interface into a concatenated string. The database is SQL Server 2008R2 (Sp3) but it is not conventional relational database by design.The system is divided into multiple sections. For example, General section data has Company name and address. Once the data is saved from the user interface it gets saved in the database in the following manner. The system is written by our sister office in another country and we do not have the source code.(ref - attachment -1)In the past few days we are experiencing a problem wherein we are getting the corrupt data after it is saved in the database(ref - attachment -2)As suggested by the core developer we checked hexadecimal version of the text which is saved in the database using following querySelect CONVERT(varbinary(max),Coded_Data),*fromTable_namewhere Primary_key = <numeric value>and section_name = 'General'and we get the hex representation like below0x[size="6"]0[/size]2072616468696B612E74686F7261744072696C2E636F6D496D706F72746572206F662054656C65636F6D6D756E69636174696F6E202620456C656374726F6E69632050726F647563742C2052656C69616E63656469676974616C2073746F72657320746F2052656C69616E6365[size="6"]A[/size]In the above representation when we remove leading zero after 0x and trailing “A” we get the correct english representation.But this pattern of data corruption / invalid character is not the same for all records. Many records have hex representation as given below where we are not sure how to conver that back to correct version of english data0x6167656D656E7420636F6E73756C74616E74456C65637472696320706F776572206C696E6520636F6E737472756374696F6E496E647573747269616C20706C616E7420636F6E737472756374696F6E4D616E75666163747572657320646573616C696E6174696F6E2065717569706D656E744F696C20616E642067617320706970656C696E6520636F6E737472756374696F6E5175616C697479206173737572616E636520636F6E73756C74616E74456E676167656420696E20636F6E737472756374696F6E202620636976696C20656E67696E656572696E679The system have fields with different data types like date, text, varchar, numbers etc. Text fields may have data copied from any source like a web page an email etc.The column that stores entire data can hold one records of 255 characters data type – varchar(255)Collation - SQL_1xCompat_CP850_CI_ASServer Collation - SQL_Latin1_General_CP1_CI_ASThis database server is recently upgraded from SQL Server 2000 to SQL Server 2008R2. We have started observing this issue immediately after migrating to SQL Server 2008R2Can we identify which are the digits cuasing data corruption from hex version and remove them at once?ThanksRohit Chitre
↧