Are the posted questions getting worse?

  • Sean Lange (5/13/2016)


    SQLRNNR (5/13/2016)


    Sean Lange (5/13/2016)


    tindog (5/13/2016)


    Sean Lange (5/13/2016)


    tindog (5/13/2016)


    Sean Lange (5/13/2016)


    Luis Cazares (5/13/2016)


    ChrisM@Work (5/13/2016)


    Sean Lange (5/13/2016)


    Brandie Tarvin (5/13/2016)


    For those who hadn't heard, THIS happened.

    Yay.

    EDIT: I should add I'm not trying to start a debate. I just wanted to pass along the news.

    IMHO people should use the bathroom that matches their parts. The whole nonsense of identity is rubbish. We are setting our children up to see things they shouldn't be seeing on other students when people with mismatched parts are using the same bathroom. To be honest what is going to happen as a result of this absurd legislation is we are going to see group bathrooms disappear. All restrooms will be gender neutral but only have enough space for 1 person.

    Young people have a tough enough time of it as it is. Imagine this: girls bathroom in high school, half a dozen excitable and sensitive girls pottering about with makeup and chatting about dates and in walks a hairy-arsed bloke like he owns the place, leaves the cubicle door open and pees all over the seat.

    Look after your minorities for sure, but not at the expense of your majorities.

    In my opinion, that "hairy-arsed bloke" wouldn't be a transgender.

    And there lies the biggest challenge. This isn't about transgender, it is about gender "identity" and there is nothing to prevent that "hairy-arsed bloke" from "identifying" as a woman today.

    I can assure you that at things like soccer games where the bathroom right now is currently at the mens room I may feel the need to identify as a woman at half time. 😉

    If people must use the bathroom that matches their bodyparts, what's to stop some man from entering the ladies and claiming to have been born female?

    If someone's perverted enough to want to go into the ladies bathroom to spy on people, let's be fair, they're going to do it either way.

    If said person is now a man then their parts would be sticking out right? If they still have female parts then they would be female. Of course there is nobody who is going to inspect but the whole thing is kind of silly.

    They could have female parts and a full beard. And no-one would be able to tell if they were being truthful without looking.

    I agree it is silly, people get beaten up and killed for being trans, let them pee wherever they feel safest. No idea why it's suddenly an issue - they've always been able to use their preferred bathroom until now.

    I agree that safety is important. I don't know how a 5th grader would feel about a girl walking into the bathroom while he is doing his thing. It seems that no matter what the answer is somebody is going to be in an awkward situation.

    I agree on safety. I don't agree that a big deal needs to be made of it.

    People have been using the bathroom (with or without the big todo over it) for which they identify for a long-time.

    Kids have always found a way to take a peek in the other bathroom - that can't be denied.

    Making a big deal out of it will encourage many of those peekers to continue to do so. It will also give those who were too timid to peek (but always wanted to) a little more leverage to do so. Those who don't care will continue to not care imho.

    I do see this as becoming a bigger problem in schools now though. It is hard enough to keep the kids at bay with the bathroom thing without giving them extra ammunition. I have worked in the school system and have close ties to the school system (family members who teach). In addition my children are still in school. This will become a bigger problem for quite a while. It will eventually die down as people get used to it.

    Frankly, the government didn't need to step in and issue an executive order (and this kind of social persuasion is essentially a threat and executive order) for this issue. People just need to grow up and act mature. I have seen plenty of transgenders in the men's room. It's no different than seeing a non-transgender in the men's room.

    The line might need to be drawn at allowing boys who identify as girls to shower with the girls (and vice versa) in the group showers in schools. I can't imagine there would be a high level of comfort there. I can also imagine some rather hefty lawsuits coming because of the discomfort that boy caused to somebody's little girl.

    Agreed on all counts. It is such a shame that the government had to step and make the situation a big deal. It is the extremes that causes me to think that group restrooms will start to decrease and we will see more like gender neutral stalls. The problem with that is it means the restroom either need to occupy more space or the capacity decreases.

    Agreed. The government tends to make a big deal out of things that should just be common sense. I come down on the side of safety.

    To Jason's point, think back to when you were in high school. What boy wouldn't want to get into the girls locker room - that's where the showers are. There's no common sense or rational thought in any of this.

  • Could some someone provide me with some UNICODE string data that casts wrong from NVARCHAR to VARCHAR and back? Don't need a lot, just a few short string values.

    Thanks.

  • Jeff Moden (5/13/2016)


    jasona.work (5/13/2016)


    So at the Detroit SQL PASS meeting last night, got to put faces to the names of those shining beacons of SQL knowledge and all things pork chop launching, Ed Wagner and Jeff Moden!

    While they did go out afterwards, I declined that invite (and with what the weather got like, guys, I'm kind of glad I did!) perhaps next time!

    Same here. Good to put a face to the name. Glad to meet you in person!

    So Jeff, when are you crossing the pond?

    😎

  • Lynn Pettis (5/13/2016)


    Could some someone provide me with some UNICODE string data that casts wrong from NVARCHAR to VARCHAR and back? Don't need a lot, just a few short string values.

    Thanks.

    Any particular type of wrongness needed (end up with a '?' instead of a unicode character, or just accent or other marks removed, etc.)?

    Cheers!

  • Lynn Pettis (5/13/2016)


    Could some someone provide me with some UNICODE string data that casts wrong from NVARCHAR to VARCHAR and back? Don't need a lot, just a few short string values.

    Thanks.

    Does this help??

    SET LANGUAGE e??????? --greek

    GO

    DECLARE @nvch NVARCHAR(40) = N'?'

    --? = ?

    --? = ?

    --? = ?

    --? -- pi

    SELECT CONVERT(VARCHAR(40), @nvch) AS ToVarChar, @nvch AS Original, CONVERT(NVARCHAR(40),CONVERT(VARCHAR(40), @nvch)) AS BacktoNvCH

    --verifying that change to language is working

    SELECT GETDATE(), DATENAME(MONTH,GETDATE())

    GO

    SET LANGUAGE us_english

    GO

    DECLARE @nvch NVARCHAR(40) = N'?'

    --? = ?

    --? = ?

    --? = ?

    --? -- pi

    SELECT CONVERT(VARCHAR(40), @nvch) AS ToVarChar, @nvch AS Original, CONVERT(NVARCHAR(40),CONVERT(VARCHAR(40), @nvch)) AS BacktoNvCH

    --verifying that change to language is working

    SELECT GETDATE(), DATENAME(MONTH,GETDATE())

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Eirikur Eiriksson (5/13/2016)


    Jeff Moden (5/13/2016)


    jasona.work (5/13/2016)


    So at the Detroit SQL PASS meeting last night, got to put faces to the names of those shining beacons of SQL knowledge and all things pork chop launching, Ed Wagner and Jeff Moden!

    While they did go out afterwards, I declined that invite (and with what the weather got like, guys, I'm kind of glad I did!) perhaps next time!

    Same here. Good to put a face to the name. Glad to meet you in person!

    So Jeff, when are you crossing the pond?

    😎

    Probably not in the cards for me.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Hugo Kornelis (5/13/2016)


    ChrisM@Work (5/13/2016)


    Young people have a tough enough time of it as it is. Imagine this: girls bathroom in high school, half a dozen excitable and sensitive girls pottering about with makeup and chatting about dates and in walks a hairy-arsed bloke like he owns the place, leaves the cubicle door open and pees all over the seat.

    Look after your minorities for sure, but not at the expense of your majorities.

    As a guy using the guys bathroom, I would get just as upset about someone leaving the cubicle door open and peeinig over the seat. This has nothing to do with gender identify, this is just plain bad manners. Bad manners are not acceptable in either a girls restroom or a boys restroom.

    The persen (of whatever physical gender and whatever gender identify) leaving the door open and peeing over the seat should be slapped and then aducated on manners.

    But here's another picture. Imagine a transgender. Born a boy, but feeling a girl inside. After a long period of mental pains and uncertainty, decides to start the procedure to get a gender change. Do you know how that procedure works? I do. The first phase requires the child (most of the time this happens just before puberty kicks in) to only change their lifestyle - assume a femal identity, dress like a girl, behave like a girl. For several months. All before any medication or any surgery is started. So now you finally get to live like the gender you had, but you are confronted with lack of understanding from many people around you. And every time you undress, you are confronted with your wrong body.

    But now also imagine your life. Sure, you go to school using a girls name, you hang with the girls, you wear make-up - and then what restroom will you use? I'd you you use the girls room. And of course carefully lock your cubicle - the last thing you want is for anyone to find out that you have a boy body; you know how cruel and brutal kids of that age are to anyone who dares to be different.

    The North Carolina law (or at least the part I understood from it from European media coverage) is particularly cruel to these children. Often these kids, when possible, time their gender behaviour change with a school change, to avoid being a victim of bullies. But how does that work if, on the first day at school you introduce yourself as a girl ... and then have to go to the boys restroom? Yup - number 1 bully victim for the rest of their school carreer.

    (I am sorry if I come of a bit strong. A very close friend of mine has a son who has been struggling with his gender identity for a very long time, including very seriously considering going through a gender change. And I can assure you as a front-row seat witness, that that is not a decision, or even a consideration, that a child takes lightly. Nor is it a situation that is even remotely easy for the child, or its parents. This boy ended up deciding not to go through with it - he realised that though he never felt a "real boy", he also is not a "real girl"; he is more an in-betweener; he realized that surgery would not really fix his problems. But during the process, I have met many children and adults in various stages of the procedure. So yes, I can get pretty vocal when people make statements on this issue that show a total lack of understanding of the actual issues.

    And before this turns into a full flame war: that last comment was made in general and not targeted at any of the people responding in this thread. I am more thinking about a few people I have met in real life.)

    Kudos!! Very well said Hugo.

    I certainly hope that nobody on this thread would put me in the group who don't consider this a real issue. I do understand the struggles (or least empathize) that struggles that many people must go through in these situations. Sadly in the US this is not as openly discussed as it is in other parts of the world. Most of my comments are not about the people this kind of thing is trying to protect, but more about the sophomoric mentality that I can see happening. Even more so in the schools than the general public. I think restrooms that are private and marked as "either" like Steve showed is a great solution to the problem. And it is what I think will likely be in store for the US eventually.

    _______________________________________________________________

    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/

  • Jacob Wilkins (5/13/2016)


    Lynn Pettis (5/13/2016)


    Could some someone provide me with some UNICODE string data that casts wrong from NVARCHAR to VARCHAR and back? Don't need a lot, just a few short string values.

    Thanks.

    Any particular type of wrongness needed (end up with a '?' instead of a unicode character, or just accent or other marks removed, etc.)?

    Cheers!

    I was looking for UNICODE data that would be fundamentally and permanently changed when converted from NVARCHAR to VARCHAR. I managed to find a string and prove that the code snippet I was looking at was wrong and would destroy UNICODE data in our database. I knew it was wrong the moment I saw it but I had to be able to prove it.

  • Chad Crawford (5/12/2016)


    Now as a counterpoint, I have a former coworker who stated that he automatically roundfiles (throws away) any resume that has a cert listed on it. That's his viewpoint and he is entitled to it. I disagree and he respects that... at least a little bit :-).

    My cert expires at the end of the year and I plan to renew during Q3.

    Chad

    I have a great deal of sympathy for your colleague, because I suspect that he's been inflicted with many well trained parrots. But in the past I discovered a use for people with certificates: a company which employed at least two people with MS certification at some (pretty low) level was able to get into certain MS programs that a company with no such employees were in theory banned from. So there was a use for the certificates. At least in theory - at one point my gang ended up sharing a stand with MS (at their invitation) at a trade show and being a preferred partner despite having only one such certificate in the company.

    But to me that was the only use for them.

    The high level certs like MCM and MCA and such like are of course a completely different story - if I'd ever seen an application from some one with one of those that would have been an automatic call in for interview.

    After reading a couple of hundred or more (no exaggeration) CVs with low level MS certifications (most recruitment agents told not to filter on them clearly did) and having my team leaders read a few hundred more between June 2000 and Jan 2001 we had found only 2 or 3 that demonstrated a capability to write a CV that indicated any capability at all (all of which turned out on interview to have indicated only an ability to lie convincingly on a CV) I concluded that my earlier theory (which was that MS certs were worthless and should be counted as a disqualification unless there was strong evidenence to contradict that in an individual case) was actually correct, although some extremely competent people (including some of my team leaders, but definitely not me) actually did hold them. Of course I've found similar absence of capability in people with UK 1st class honours degrees or American bachelors degrees summa cum laude in Computer science - not quite as often, of course, because those are a bit more difficult to obtain that the lower level (ie the remaining) MS certs, but the top degree holders were not quite as consistely incompetent as the MS certiicate holders.

    Tom

  • BLOB_EATER (5/13/2016)


    ThomasRushton (5/13/2016)


    BLOB_EATER (5/13/2016)


    Brandie Tarvin (5/13/2016)


    BLOB_EATER (5/13/2016)


    This is what probed my question...

    YIKES!

    I hope Microsoft at least thanked you for submitting to that probe.

    Or maybe the company's been taken over by aliens... Tell me, BE, have you been abducted recently? Seen any strange lights?

    Well, I'll be honest now, after 5 interviews rounds with them which ended in a "no" I saw more than lights.... :crazy:

    And I bet they never bought you dinner or sent you flowers...

    Funny enough it was me chasing them on feedback, like a teenage boy trying to make contact with that girl across the classroom.... awkward.

    Should probably avoid chasing - it can make them think "If you're that desperate it must be because everyone has turned you down, so we'd be silly not to". A polite email after the interview saying something like "thank you for spending the time to interview me, I enjoyed meeting you" and not saying "I hope to hear from you soon" is ok, but any more than that will usually decrease their interest in you.

    Tom

  • Hugo Kornelis (5/13/2016)


    ....

    But here's another picture. Imagine a transgender. Born a boy, but feeling a girl inside. After a long period of mental pains and uncertainty, decides to start the procedure to get a gender change. Do you know how that procedure works? I do. The first phase requires the child (most of the time this happens just before puberty kicks in) to only change their lifestyle - assume a femal identity, dress like a girl, behave like a girl. For several months. All before any medication or any surgery is started. So now you finally get to live like the gender you had, but you are confronted with lack of understanding from many people around you. And every time you undress, you are confronted with your wrong body.

    But now also imagine your life. Sure, you go to school using a girls name, you hang with the girls, you wear make-up - and then what restroom will you use? I'd you you use the girls room. And of course carefully lock your cubicle - the last thing you want is for anyone to find out that you have a boy body; you know how cruel and brutal kids of that age are to anyone who dares to be different.

    The North Carolina law (or at least the part I understood from it from European media coverage) is particularly cruel to these children. Often these kids, when possible, time their gender behaviour change with a school change, to avoid being a victim of bullies. But how does that work if, on the first day at school you introduce yourself as a girl ... and then have to go to the boys restroom? Yup - number 1 bully victim for the rest of their school carreer.

    (I am sorry if I come of a bit strong. A very close friend of mine has a son who has been struggling with his gender identity for a very long time, including very seriously considering going through a gender change. And I can assure you as a front-row seat witness, that that is not a decision, or even a consideration, that a child takes lightly. Nor is it a situation that is even remotely easy for the child, or its parents. This boy ended up deciding not to go through with it - he realised that though he never felt a "real boy", he also is not a "real girl"; he is more an in-betweener; he realized that surgery would not really fix his problems. But during the process, I have met many children and adults in various stages of the procedure. So yes, I can get pretty vocal when people make statements on this issue that show a total lack of understanding of the actual issues.

    And before this turns into a full flame war: that last comment was made in general and not targeted at any of the people responding in this thread. I am more thinking about a few people I have met in real life.)

    Well said. You are demonstrating as clear a view of this problem as we all have learnt you have of SQL-related problems, and you are 100% right here, even more surely correct than I've learnt to expect you to be (with perhaps some extremely rare exceptions) on the technical stuff.

    I must admit I've been a bit embarrassed when exposing myself in both-sexes shower rooms. But there are both-sexes nudist areas like the Papagayo beach in Lanzarote and the Englischer Garten in Munich and several places on the mediterranean cost of France where I don't feel the least bit embarrassed, because in those places I know that displaying one's parts, whatever sex one has physically or professes mentally, is the norm. (It's probably the same in the shower rooms where I've been embarrrassed, but I haven't managed to believe that it is.)

    Tom

  • Lynn Pettis (5/13/2016)


    Jacob Wilkins (5/13/2016)


    Lynn Pettis (5/13/2016)


    Could some someone provide me with some UNICODE string data that casts wrong from NVARCHAR to VARCHAR and back? Don't need a lot, just a few short string values.

    Thanks.

    Any particular type of wrongness needed (end up with a '?' instead of a unicode character, or just accent or other marks removed, etc.)?

    Cheers!

    I was looking for UNICODE data that would be fundamentally and permanently changed when converted from NVARCHAR to VARCHAR. I managed to find a string and prove that the code snippet I was looking at was wrong and would destroy UNICODE data in our database. I knew it was wrong the moment I saw it but I had to be able to prove it.

    Hi Lynn. As Jacob was alluding to, there are multiple ways to "mangle" Unicode strings. For example:

    Most common: not available in Code Page implied by the Collation, and no approximation

    SELECT NCHAR(0x2620) AS [From_Hex/Binary], NCHAR(9760) AS [From_Decimal],

    UNICODE(N'?') AS [To_Decimal], '?' AS [To_VARCHAR];

    -- ? ? 9760 ?

    Less common: not available in Code Page implied by the Collation, but there is a "best fit" approximation

    DECLARE @SquareRoot NVARCHAR(5) = NCHAR(0x221a);

    SELECT @SquareRoot,

    CONVERT(VARCHAR(10), @SquareRoot),

    CONVERT(NVARCHAR(10), CONVERT(VARCHAR(10), @SquareRoot));

    -- v v v

    Even less common: Surrogate Pairs; won't survive most string functions (e.g. SUBSTRING, REVERSE, etc) when not using a Collation ending in "_SC" (introduced in SQL Server 2012), even if all datatypes are NVARCHAR

    DECLARE @SupplementaryChar NCHAR(2) = NCHAR(0xD800) + NCHAR(0xDF21); -- surrogate pair

    SELECT @SupplementaryChar AS [Original],

    CONVERT(VARCHAR(10), @SupplementaryChar) AS [To_VARCHAR];

    -- ?? ??

    SQL#https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
    Sql Quantum Lifthttps://SqlQuantumLift.com/ ( company )
    Sql Quantum Leaphttps://SqlQuantumLeap.com/ ( blog )
    Info sitesCollations     •     Module Signing     •     SQLCLR

  • Solomon Rutzky (5/14/2016)


    Lynn Pettis (5/13/2016)


    Jacob Wilkins (5/13/2016)


    Lynn Pettis (5/13/2016)


    Could some someone provide me with some UNICODE string data that casts wrong from NVARCHAR to VARCHAR and back? Don't need a lot, just a few short string values.

    Thanks.

    Any particular type of wrongness needed (end up with a '?' instead of a unicode character, or just accent or other marks removed, etc.)?

    Cheers!

    I was looking for UNICODE data that would be fundamentally and permanently changed when converted from NVARCHAR to VARCHAR. I managed to find a string and prove that the code snippet I was looking at was wrong and would destroy UNICODE data in our database. I knew it was wrong the moment I saw it but I had to be able to prove it.

    Hi Lynn. As Jacob was alluding to, there are multiple ways to "mangle" Unicode strings. For example:

    Most common: not available in Code Page implied by the Collation, and no approximation

    SELECT NCHAR(0x2620) AS [From_Hex/Binary], NCHAR(9760) AS [From_Decimal],

    UNICODE(N'?') AS [To_Decimal], '?' AS [To_VARCHAR];

    -- ? ? 9760 ?

    Less common: not available in Code Page implied by the Collation, but there is a "best fit" approximation

    DECLARE @SquareRoot NVARCHAR(5) = NCHAR(0x221a);

    SELECT @SquareRoot,

    CONVERT(VARCHAR(10), @SquareRoot),

    CONVERT(NVARCHAR(10), CONVERT(VARCHAR(10), @SquareRoot));

    -- v v v

    Even less common: Surrogate Pairs; won't survive most string functions (e.g. SUBSTRING, REVERSE, etc) when not using a Collation ending in "_SC" (introduced in SQL Server 2012), even if all datatypes are NVARCHAR

    DECLARE @SupplementaryChar NCHAR(2) = NCHAR(0xD800) + NCHAR(0xDF21); -- surrogate pair

    SELECT @SupplementaryChar AS [Original],

    CONVERT(VARCHAR(10), @SupplementaryChar) AS [To_VARCHAR];

    -- ?? ??

    Yes, I am aware. I was looking for a string or strings that would not survive conversion from NVARCHAR to VARCHAR. Trying to search our database for some possible HANGUL characters wasn't working, possibly due to multiple rebuilds of servers for testing.

  • Lynn Pettis (5/13/2016)


    Could some someone provide me with some UNICODE string data that casts wrong from NVARCHAR to VARCHAR and back? Don't need a lot, just a few short string values.

    Thanks.

    Wouldn't this be the list?

    😎

    USE tempdb;

    GO

    SET NOCOUNT ON;

    DECLARE @SAMPLE_SIZE INT = 65535;

    ;WITH T(N) AS (SELECT N FROM (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) AS X(N))

    , NUMS(N) AS (SELECT TOP(@SAMPLE_SIZE) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS N FROM T T1,T T2,T T3,T T4,T T5)

    SELECT

    NM.N

    ,NCHAR(NM.N) AS N_CHAR

    ,CONVERT(CHAR(1),NCHAR(NM.N),0) AS N_TO_CHAR

    ,CONVERT(NCHAR(1),CONVERT(CHAR(1),NCHAR(NM.N),0),0) AS N_TO_C_TO_N_CHAR

    FROM NUMS NM

    WHERE (NCHAR(NM.N)) <> (CONVERT(NCHAR(1),CONVERT(CHAR(1),NCHAR(NM.N),0),0));

  • Lynn Pettis (5/15/2016)


    Solomon Rutzky (5/14/2016)


    Lynn Pettis (5/13/2016)


    Jacob Wilkins (5/13/2016)


    Lynn Pettis (5/13/2016)


    Could some someone provide me with some UNICODE string data that casts wrong from NVARCHAR to VARCHAR and back? Don't need a lot, just a few short string values.

    Thanks.

    Any particular type of wrongness needed (end up with a '?' instead of a unicode character, or just accent or other marks removed, etc.)?

    Cheers!

    I was looking for UNICODE data that would be fundamentally and permanently changed when converted from NVARCHAR to VARCHAR. I managed to find a string and prove that the code snippet I was looking at was wrong and would destroy UNICODE data in our database. I knew it was wrong the moment I saw it but I had to be able to prove it.

    Hi Lynn. As Jacob was alluding to, there are multiple ways to "mangle" Unicode strings. For example:

    Most common: not available in Code Page implied by the Collation, and no approximation

    SELECT NCHAR(0x2620) AS [From_Hex/Binary], NCHAR(9760) AS [From_Decimal],

    UNICODE(N'?') AS [To_Decimal], '?' AS [To_VARCHAR];

    -- ? ? 9760 ?

    Less common: not available in Code Page implied by the Collation, but there is a "best fit" approximation

    DECLARE @SquareRoot NVARCHAR(5) = NCHAR(0x221a);

    SELECT @SquareRoot,

    CONVERT(VARCHAR(10), @SquareRoot),

    CONVERT(NVARCHAR(10), CONVERT(VARCHAR(10), @SquareRoot));

    -- v v v

    Even less common: Surrogate Pairs; won't survive most string functions (e.g. SUBSTRING, REVERSE, etc) when not using a Collation ending in "_SC" (introduced in SQL Server 2012), even if all datatypes are NVARCHAR

    DECLARE @SupplementaryChar NCHAR(2) = NCHAR(0xD800) + NCHAR(0xDF21); -- surrogate pair

    SELECT @SupplementaryChar AS [Original],

    CONVERT(VARCHAR(10), @SupplementaryChar) AS [To_VARCHAR];

    -- ?? ??

    Yes, I am aware. I was looking for a string or strings that would not survive conversion from NVARCHAR to VARCHAR.

    Yes, I understand what you were looking for. And that is why I provided those 3 examples: they are easy to use for such testing, and test three different meanings of "would not survive conversion from NVARCHAR to VARCHAR" 🙂

    SQL#https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
    Sql Quantum Lifthttps://SqlQuantumLift.com/ ( company )
    Sql Quantum Leaphttps://SqlQuantumLeap.com/ ( blog )
    Info sitesCollations     •     Module Signing     •     SQLCLR

Viewing 15 posts - 54,121 through 54,135 (of 66,000 total)

You must be logged in to reply to this topic. Login to reply