System: SharePoint 2010 and SQL Server 2012.

Question : how to get data from a content database field that are tCompressedString(varbinary) type? For example, table [Content_DB].[dbo].[AllWebParts] column [tp_View] data.

I know, that peaking in these databases are unsupported by Microsoft.. I am just curious.

I have tried few option, no success:

  • DECOMPRESS ( [value] ) is not working, because function is not support in SQL Server 2012
  • SELECT CAST( [value] AS VARCHAR(MAX)) is returning '¨©01'
  • SELECT CONVERT(VARCHAR(max), [value], 0) with variations of last parameter (tried from 0 till 4), returns same varbinary value or '¨©01'

Querying the database directly is not recommended or supported. See other methods for reading data, such as pnp PowerShell. But binary data is just that: binary. It's not a varchar. A sql developer who adds a binary field to a table is doing so to store things like image files or other types of files in the table. This sort of content cannot be read by converting it to a character string.

  • Thanks for answering. But is there something, even outside SQL (like PowerShell or C# functions) that could bet data out of binary? – Kristaps Vilerts Jan 11 at 13:21
  • Out of binary? Perhaps check out this article which explains what varbinary is and what it's used for: sqlservercentral.com/articles/DataTypes/95761 – Mike2500 Jan 11 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.