July 1, 2016 at 10:50 am
ScottPletcher (7/1/2016)
I still say don't explicitly code it unless the code requires it (some system procs require unicode strings specifically, for example), because it can cause performance errors or mismatches but cannot prevent any.
Understood but that's the very thing I'm talking about. While it's a good idea to avoid performance errors and what you're talking about can help, it's also good to avoid data errors and the method you're talking about could cause an error. Always paying attention to what should be typed is the best policy. Choosing the lesser of two evils is still an "evil" thing. Better to just do it right. "Must look eye". 🙂
--Jeff Moden
Change is inevitable... Change for the better is not.
July 1, 2016 at 11:08 am
Jeff Moden (7/1/2016)
ScottPletcher (7/1/2016)
I still say don't explicitly code it unless the code requires it (some system procs require unicode strings specifically, for example), because it can cause performance errors or mismatches but cannot prevent any.Understood but that's the very thing I'm talking about. While it's a good idea to avoid performance errors and what you're talking about can help, it's also good to avoid data errors and the method you're talking about could cause an error. Always paying attention to what should be typed is the best policy. Choosing the lesser of two evils is still an "evil" thing. Better to just do it right. "Must look eye". 🙂
So if a column changes from non-unicode to unicode, you're going to insist that all existing code be changed to explicitly specify unicode strings for that column?
What about when that value is being concatenated to another value that is not unicode? Forcing any part of a sgring to be unicode ultimately forces it all to be unicode, and unicode could truncate the string at 4000 bytes.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 1, 2016 at 4:06 pm
ScottPletcher (7/1/2016)
Jeff Moden (7/1/2016)
ScottPletcher (7/1/2016)
I still say don't explicitly code it unless the code requires it (some system procs require unicode strings specifically, for example), because it can cause performance errors or mismatches but cannot prevent any.Understood but that's the very thing I'm talking about. While it's a good idea to avoid performance errors and what you're talking about can help, it's also good to avoid data errors and the method you're talking about could cause an error. Always paying attention to what should be typed is the best policy. Choosing the lesser of two evils is still an "evil" thing. Better to just do it right. "Must look eye". 🙂
So if a column changes from non-unicode to unicode, you're going to insist that all existing code be changed to explicitly specify unicode strings for that column?
What about when that value is being concatenated to another value that is not unicode? Forcing any part of a sgring to be unicode ultimately forces it all to be unicode, and unicode could truncate the string at 4000 bytes.
Enough is enough. Just agree to disagree and stop this nonsense.
July 1, 2016 at 5:29 pm
ScottPletcher (7/1/2016)
So if a column changes from non-unicode to unicode, you're going to insist that all existing code be changed to explicitly specify unicode strings for that column?
Actually, yes. That would be a part of the impact study of making that kind of a change. You'd have to change the variables in the procs, anyway, so why not any literals?
What about when that value is being concatenated to another value that is not unicode? Forcing any part of a sgring to be unicode ultimately forces it all to be unicode, and unicode could truncate the string at 4000 bytes.
If either the source or the target is a Unicode variable or column, yes. Using the correct data types are important to performance and, as we've seen thanks to Sergiy's code example, it can cause errors if you don't.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 31 through 34 (of 34 total)
You must be logged in to reply to this topic. Login to reply