none
how to get the bytes store in disk for a column? RRS feed

  • Question

  • can we get the bytes store on disk for a column? Sometime there are hidden value in the column and I can't get it without know the bytes stored on disk. On oracle we can use the dump() function. Do we have similar function on sql server?

    Sunday, July 3, 2011 9:20 AM

Answers

  • I thnk we need and example. SQL Server does domaint checking when you modify/insert so trying to inut something which isn't valid for that data type would cause a data type overflow run-time error. There was some exceptions in earliers versions (2000 and earlier) when you bulk-loaded data, and such you can check for using DATA_PURITY with DBCC CHECKDB,

    The only other thing I can thnk of is if you have NUL in strings, with more letters after that NUL and also C-code that reads the data and considers this NUL as string termination. I've even seen this with SQL Server's own system functions (being written in C++), whan doing (ugly) string operations like combos of SUBSTRING, REVERSE and such.

    Finally, you an always CAST to some of the binary or varbinary types...

    I'm curious, such an unusual request. Can you share more information?


    Tibor Karaszi, SQL Server MVP | web | blog
    • Proposed as answer by Peja Tao Tuesday, July 5, 2011 5:47 AM
    • Unproposed as answer by Peja Tao Tuesday, July 5, 2011 6:32 AM
    • Marked as answer by Daniel Wu Thursday, July 7, 2011 12:40 AM
    Monday, July 4, 2011 1:00 AM
    Moderator
  • Hi Daniel,

    You could use DBCC PAGE ( [database name | database id], [fileid], [Page Number], [Optional Detail Level] ) to dump out  data pages like dump() function in Oracle. Through this ,you could see the byte information store for a table.
    There is a very good online blog by Klaus Aschenbrenner you could refer to:
    The mystery of the NULL bitmap mask

    Hope this hleps.


    Best Regards,
    Peja

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by Daniel Wu Thursday, July 7, 2011 12:40 AM
    Tuesday, July 5, 2011 6:32 AM

All replies

  • I thnk we need and example. SQL Server does domaint checking when you modify/insert so trying to inut something which isn't valid for that data type would cause a data type overflow run-time error. There was some exceptions in earliers versions (2000 and earlier) when you bulk-loaded data, and such you can check for using DATA_PURITY with DBCC CHECKDB,

    The only other thing I can thnk of is if you have NUL in strings, with more letters after that NUL and also C-code that reads the data and considers this NUL as string termination. I've even seen this with SQL Server's own system functions (being written in C++), whan doing (ugly) string operations like combos of SUBSTRING, REVERSE and such.

    Finally, you an always CAST to some of the binary or varbinary types...

    I'm curious, such an unusual request. Can you share more information?


    Tibor Karaszi, SQL Server MVP | web | blog
    • Proposed as answer by Peja Tao Tuesday, July 5, 2011 5:47 AM
    • Unproposed as answer by Peja Tao Tuesday, July 5, 2011 6:32 AM
    • Marked as answer by Daniel Wu Thursday, July 7, 2011 12:40 AM
    Monday, July 4, 2011 1:00 AM
    Moderator
  • Hi Daniel,

    You could use DBCC PAGE ( [database name | database id], [fileid], [Page Number], [Optional Detail Level] ) to dump out  data pages like dump() function in Oracle. Through this ,you could see the byte information store for a table.
    There is a very good online blog by Klaus Aschenbrenner you could refer to:
    The mystery of the NULL bitmap mask

    Hope this hleps.


    Best Regards,
    Peja

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by Daniel Wu Thursday, July 7, 2011 12:40 AM
    Tuesday, July 5, 2011 6:32 AM
  • Thanks Peja

    it works for me.

     

    Thanks Tibor,

    also a great suggestion.

    Thursday, July 7, 2011 12:41 AM