• Golfer22 (12/25/2012)


    Tinyint and bit have a higher precedence than ntext. Why is this? Couldn't ntext we complex alphanumeric values? Tinyint and bit are limited and simple.

    What precedence does hieararchyid data type have? I looked here but didn't see anything: http://msdn.microsoft.com/en-us/library/ms190309.aspx%5B/quote%5D

    You kind of have 2 or 3 questions here.

    Why is tinyint a higher precedence than ntext? First of all ntext is deprecated so you shouldn't be using it at all. Your argument of it could be complex alphanumeric values is exactly why it fall on the precedence list where it is. You can't do math on alphanumeric values. They have to be numeric to perform calculations. The more relevant reason is that you have crossed the line from something that can be used in a mathematical equation to something that can't (well maybe it can IF the data can be converted).

    Your second question is about the precedence of HierarchyID. My question would be, does it really matter? Are you going to be implicitly converting to/from the hierarchyID datatype?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/