Difference in string comparisons between varchar and nvarchar

These statements were executed on SQL Server 2008 R2 Enterprise.  Collation is the default SQL_Latin1_General_CP1_CI_AS.
Any ideas why the difference in behavior?
DECLARE @StringWithCharZero VARCHAR(100), @StringWithoutCharZero VARCHAR(100);
SELECT @StringWithCharZero = CHAR(0) + 'TEST', @StringWithoutCharZero = 'TEST';
IF @StringWithCharZero = @StringWithoutCharZero
BEGIN
PRINT 'VARCHAR EQUAL';
select ASCII(LEFT(@StringWithCharZero, 1)), ASCII(LEFT(@StringWithoutCharZero, 1));
END
ELSE
BEGIN
PRINT 'VARCHAR NOT EQUAL';
select ASCII(LEFT(@StringWithCharZero, 1)), ASCII(LEFT(@StringWithoutCharZero, 1));
END;
GO
DECLARE @StringWithCharZero NVARCHAR(100), @StringWithoutCharZero NVARCHAR(100);
SELECT @StringWithCharZero = NCHAR(0) + N'TEST', @StringWithoutCharZero = N'TEST';
IF @StringWithCharZero = @StringWithoutCharZero
BEGIN
PRINT 'NVARCHAR EQUAL';
select UNICODE(LEFT(@StringWithCharZero, 1)), UNICODE(LEFT(@StringWithoutCharZero, 1));
END
ELSE
BEGIN
PRINT 'NVARCHAR NOT EQUAL';
select UNICODE(LEFT(@StringWithCharZero, 1)), UNICODE(LEFT(@StringWithoutCharZero, 1));
END;
GO

Hello,
I got the followng result after run the query on SQL Server 2008R2 SP2 Enterprise edition:
SQL Server specific version: Microsoft SQL Server 2008 R2 (SP2) - 10.50.4260.0 (X64)   Jul 11 2012 15:47:13   Copyright (c) Microsoft Corporation  Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack
1) (Hypervisor)
Please install the latest Service Pack for SQL Server 2008R2, we can get it from the link below:
How to obtain the latest service pack for SQL Server 2008 R2:
http://support.microsoft.com/kb/2527041
Regards,
Elvis Long
TechNet Community Support

Similar Messages

  • What is the difference/comparison between AppRf and WebCC ?

    Q: What is the difference/comparison between AppRf and WebCC ?
    A:  
    Comparison between AppRf and WebCC:
    AppRF
    WebCC
    2300+ Apps under 21 app categories
    Millions of URLs under 80+ categories
    Need up to 7 packets to classify
    Classified once HTTP GET is received
    Classification
    Classification + Reputation
    Need AOS upgrade to get new Apps
    Dynamic update of WebCC database
    Static content based classification
    Dynamic content based categorization / reputation

    Or put another way:
    Albums organise Photos
    Folders organise Albums
    A Photo cannot be in a Folder, only in an Album.

  • Difference in the Balance between FS10N and Customer Balances in Local Curr

    Hi,
    When i am trying to match the Balances between FS10N and Customer Balances in Local Currency for the Period 8, we are getting the difference, The reconcilliaton Account was changed on 30.08.2010.
    Please help Us in tracing the differences between FS10N and Customer Balances in Local Currency.
    What could be the possible reasons for the differences..
    Thanks

    Hi Varshani,
    Please use the program/report SAPF070 to compare or reconcile your AR with GL balances. You can use SAPF071 to correct any inconsistencies. Provided below documentation for these programs.
    SAPF070  - Compare Documents and Account Transaction Figures
    Description
    This program compares debit and credit transaction figures in customer, vendor, and G/L accounts with the debit and credit totals from documents posted in the corresponding posting period (accounting reconciliation). The sales totals are also compared for customer and vendor accounts. There is no separate comparison for special G/L transactions.
    A comparison for G/L accounts can be made in company code currency and in parallel currencies (such as group currency). A comparison for customer and vendor accounts can only be made in company code currency.
    After the program has finished, a message is issued to the user that started the program. This message summarizes the results of the reconciliation.
    Output
    The program compares the totals of an account on a periodic basis. If the debit and credit total differs between account and documents, the account is printed with the debit and credit totals and the difference.
    Differences in G/L accounts are shown per transaction currency. The first line shows the amount in local currency, the second line shows the amounts in transaction currency.
    If a document which falls within the selection range is posted during the program run, the program is terminated since a reliable result can no longer be delivered.
    SAPF071 - Adjust Balances after Comparing Documents/Transaction Figures
    Description
    If a financial accounting comparative analysis (SAPF190) or a comparison of documents and transaction figures (SAPF070) shows that there are differences between documents and transaction figures, you can use this program to make an adjustment. The documents form the basis for this adjustment. The program adjusts the (redundant) transaction figures, which are only totals of amounts from documents.
    Requirements
    All of the following listed requirements must be fulfilled:
    1. A financial accounting comparative analysis (SAPF190) or a comparison of documents and transaction figures (SAPF070) must be made, and differences must be found between documents and transaction figures.
    2. There must not be any inconsistent documents found. These are listed in both SAPF070 and SAPF190 as well as in this program.
    3. There cannot be any problems in the other modules. Caution: You have to check this yourself. Financial Accounting may be correct but the other modules may not be, and this will adversely affect the program run.
    4. You can only make the adjustment in the ledgers which are compared by program SAPF070. This is ledger 00 or a user-defined ledger for all parallel local currencies except the group currency. (The program displays these ledgers). You have to adjust any additional ledgers as well as average balance ledgers yourself.
    5. No documents during the period in which you are adjusting transaction figures can be archived. Caution: You must ensure that these documents are not archived by establishing appropriate organizational rules and procedures.
    Only use this program after consulting with SAP or after checking the prerequisites thoroughly.
    You should adjust all differences together for a single company code. By setting the program parameters you can limit the adjustment to G/L currency types or to balances in subledgers.
    It is advisable to execute a test run first, which will list any differences that are found.
    Further notes - Authorizations
    Repair program authorization group (F_005)
    Company code authorization         (F_BKPF_BUK)
    Thanks
    Venkata Ganesh Perumalla
    Edited by: Venkata Ganesh Perumalla on Sep 28, 2010 1:30 PM

  • Comparison between 3750 and 3750-metro

    hi folks,
    is there any links which will provide me on the comparison between 3750 and 3750-metro? for exapmple, isis is not support on 3750 but it support on 3750-metro. The product information from cisco site is insufficient in term of the main differences :p
    rgd
    josh.w

    Hi Josh,
    The Cisco Catalyst 3750 Metro Series is built for Metro Ethernet access in a customer location, enabling the delivery of more differentiated Metro Ethernet services. These switches feature bidirectional hierarchical QoS and Traffic Shaping, intelligent 802.1Q tunneling with class-of-service (CoS) mutation, VLAN translation, MPLS, EoMPLS, and Hierarchical Virtual Private LAN Service (H-VPLS) support, and redundant AC or DC power. They are ideal for service providers seeking to deliver profitable business services, such as Layer 2, Layer 3, and MPLS VPNs, in a variety of bandwidths and with different SLAs.
    The metro switches have the PXF chips (which allow hierarchical QoS on the 2 "WAN" GigE ports, so several logical links can share a connection, and have soft bandwidth limits).
    For more details on 3750-M switches have a look at this link
    http://www.cisco.com/en/US/products/hw/switches/ps5532/products_qanda_item09186a00801eb822.shtml
    HTH
    Ankur
    *Pls rate all helpfull post

  • Difference in text rendering between PDF and Mars?

    I was doing some testing with Mars and stumbled upon what
    seemed like suboptimal text rendering. Because it was quite subtle
    and I wanted to make sure there was an actual difference, I did a
    little comparison between PDF and Mars rendering.
    See this image. Can
    you see a difference?
    I'm still not sure whether there is an actual difference, but
    I still somehow got the impression that the upper example (PDF) is
    a little more polished then the lower one (Mars). Are different
    rendering paths actually used? Will it remain that way?
    My SVG for Mars was very simple:
    <text font-size="10pt" x="20" y="20" fill="rgb(0,0,0)"
    font-family="F0">aex</text>
    The PDF was produced with MS Office 2007 and Microsofts Save
    as PDF plugin (also at 10pts). The font is Gentium.

    The difference *IS* subtle, but you're right -- there does
    appear to be a perceptible difference between the two samples.
    Without making an in-depth study, it's hard to say whether we
    can do anything about this. Even though they're both opened in
    Acrobat, the rendering path for a Mars document is *VERY* different
    from the path for a PDF document, and many of the events along the
    chain are out of the control of those of us writing the Mars
    plugin. There are some text-quality issues that I'd like to take
    care of in time for our next release, however; perhaps I'll be able
    to address this particular issue at the same time.

  • Comparison between Purisma and JCAPS?

    I am researching several CDI (Customer Data Integration) solutions and I've narrowed this down to two solutions Purisma and JCAPS. I am mainly comparing the matching engines, record linkage efficiency and any machine learning capabilities.
    Has anyone done a "head-to-head" comparison between JCAPS and Purisma?
    Does anyone have any screenshots of the JCAPS record linkage tool for manual duplicate handling?
    My blog: http://mycodeblog.blogspot.com

    Why not write a test class? Shouldn't take long.

  • Comparison between Forms6i and Forms9i

    We have some client/server-based applications built in Forms6i and are considering to convert/rebuild them into Forms9i or JDeveloper as web-based applications. Has anyone done any comparison between Forms6i and Forms9i/JDeveloper? Or, can you point me to such documentation if existed?
    Thanks.

    For comparison between forms 6i and Oracle9i Forms check out the new features paper on:
    http://otn.oracle.com/products/forms
    Comparison to JDeveloper? How about the fact that you develop with Java language in JDeveloper and with PL/SQL in Forms.
    I would suggest that first you try to run your application on the Web using forms 6i. This should be a very simple test to do. See how you like it and only then ask yourself if you really need to go to JDeveloper.

  • Comparison between PeopleSoft and Fusion

    Hi ,
        I need to prepare a document to show up the comparison between PeopleSoft and Fusion. For eg: Business Unit in PeopleSoft and what is the concept in Fusion that is similar to Business Unit. Can anyone help me with a document that will give me detailed comparison between PeopleSoft and Fusion.
    Thanks,
    Fathima Farsatha

    I can't find any comparison on the internal database.  Can you add more about your goals with the question?  Are you stuck with a Business unit issue or functionality.  Since Fusion was built form the ground up it is a completely different software product.  If you have a very specific question then we might be able to collaborate with different groups and provide an answer or fix.

  • Comparison between OATS and QTP

    Hi,
    Does anyone have a kind of comparison between QTP and Oracle ATS ?
    Thanks

    Hi
    I don't think there is a paper that compares both tools, is there anything in particular that you would like to know?
    Regards
    Alex

  • Differences in sort order between iTunes and iPod

    Can someone explain how the sort order of artists / albums works? It seems that it is different between iTunes and the iPod. In iTunes (7.3.1) I can enter data in the fields for Artist, Album Artist, Sort Artist and Sort Album Artist. When I get the tracks to appear in the order I want in iTunes, it doesn’t seem to transfer across to my iPod. I know there are some differences in how the sort order works in both, but how is it different?
    John.
    Dell 5150   Windows XP  

    ou must have an older iPod.
    I believe the new sort order only works on the new iPods (Nano and Video)

  • Difference in PL/SQL between 8i and 9i

    Hi
    Where can I find the exact differences in PL/SQL alone between 8i and 9i from developers point of view.
    I appreciate your help
    Thanks

    Well, you would find it at the most obvious place - The Oracle documentation, where else?
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/whatsnew.htm#967650

  • Comparison between cFP and cDAQ

    Hi,
    I'm looking for (as much details as possible) a comparisons between compact Fieldpoint and compact DAQ hardware.  I'm trying to decide which hardware platforms to use.
    TIA

    Compact Fieldpoint is for installed, industrial type applications.  It has a realtime operating system.  The controller runs code to read inputs and operate outputs.  The application can be distributed on an ethernet network.  There are different modules available for different types of inputs and ouputs.
    Compact DAQ also has numerous input and output modules.  It is more intended for portable applications.  It connects to your PC through a USB port.  So the code would need to run on the PC

  • Comparisons between WLI and SeeBeyond e*Gate Integrator?

    Does anyone have any point of view about similarities and differences between
    WLI and SeeBeyond e*Gate Integrator? I have some familiarity with e*Gate, and
    I'm just starting to learn about WLI (although I'm pretty familiar with J2EE
    and WebLogic Server).
    It appears to me that WLI assumes that data collaborations between systems will
    go from binary to XML, then perhaps to transformed XML, and then to binary.
    I'm perfectly happy with using XML, but I wonder if it would be practical in
    some cases to skip the XML representation and translate directly from one
    binary representation to another. From what little I know of e*Gate, the most
    straightforward transformations are just binary to binary, although XML
    transformations are available.
    ===================================================================
    David M. Karr ; Java/J2EE/XML/Unix/C++
    [email protected] ; SCJP; SCWCD

  • Difference in event handling between Java and Java API

    could anyone list the differences between Java and java-API in event handling??
    thanks,
    cheers,
    Hiru

    the event handling mechanisms in java language
    features and API (java Application Programming
    Features)features .no library can work without a
    language and no language has event handling built in.
    I am trying to compare and contrast the event
    handling mechanisms in the language and library
    combinations such as java/ java API.
    all contributions are welcome!
    thanks
    cheersSorry, I'm still not getting it. I know what Java is, and I know what I think of when I hear API. (Application Programming Interface.) The API is the aggregation of all the classes and methods you can call in Java. If we agree on that, then the event handling mechanisms in Java and its API are one and the same.
    So what do you want to know?
    %

  • Comparisons between X61s and X201s - and X201 and X201s

    I have been very happy with my x61s since prchasing it in Jan 2008. However, I need to migrate to a new notebook, want to have a similar experience with the new machine and am therefore considering the X201 series. Can anyone give me a high-level comparison (I've reviewed the tech specs at lenovo.com already) between the x61s and the x201 series? I am also interested in the differences between the x201 and the x201s.
    Finally, will the x61 docking base that I purchased for that notebook work on the x201 or x201s?
    Thanks!

    X61s Specification
    Display
    12.1" (1024 x 768) XGA
    Operating System
    Windows Vista Business, Windows XP Professional, Windows Vista Ultimate
    Processor
    Core 2 Duo 1.6 GHz
    Memory
    1 GB - 2 GB
    Hard Drive
    80 GB - 160 GB Serial ATA (5400 - 7200 rpm)
    Graphics Card
    GMA X3100
    Optical Drive
    DVD-Writer, DVD±RW (±R DL) / DVD-RAM
    Connectivity
    Bluetooth 2.0 + EDR (Enhanced Data Rate)
    Ethernet (RJ-45 connector)
    Wireless LAN
    Ports and Expandibility
    Audio in
    Audio out
    Three Hi-Speed USB ports
    VGA port
    CardBus
    Card reader
    RJ11 Modem jack
    Firewire
    Battery
    8.2 hours - 9 hours
    8 cell 5200 mAh lithium ion
    Dimensions
    10.6" x 9.4" x 0.8" - 1.4" (26.9cm x 23.9cm x 2cm - 3.6cm)
    Weight
    3.3 lbs - 3.6 lbs (1.5 kg - 1.63 kg)
    Built in Extras
    Fingerprint reader
    X201s Specification
    Display
    12.1" (1440 x 900) WXGA+
    Operating System
    Windows 7 Professional 64-bit Edition
    Processor
    Core i7 2.13 GHz
    Memory
    4 GB - 8 GB
    Hard Drive
    320 GB Serial ATA (7200 rpm)
    Graphics Card
    GMA HD
    Optical Drive
    DVD-Writer
    Connectivity
    Bluetooth 2.1 + EDR (Enhanced Data Rate)
    Ethernet (RJ-45 connector)
    Wireless LAN
    Ports and Expandibility
    Audio in
    Audio out
    Three Hi-speed USB ports
    VGA port
    Express card 54
    5-in-1 card reader
    RJ11 Modem jack
    Battery
    7.4 hours
    6 cell lithium ion
    Dimensions
    11.6" x 8.3" x 1.4" (29.46cm x 21.08cm x 3.56cm)
    Weight
    2.7 lbs (1.22 kg)
    Built in Extras
    Fingerprint reader
    X201 Specification
    Display
    12.1" 1280 x 800 (WXGA)
    Operating System
    Windows 7 Professional
    Processor
    Core i5 2.53 GHz
    Memory
    2 GB - 8 GB
    Hard Drive
    250 GB Serial ATA (5400 rpm) / 320 GB Serial ATA (7200 rpm)
    Graphics Card
    GMA HD
    Optical Drive
    DVD-Writer
    Connectivity
    Bluetooth 2.1 + EDR (Enhanced Data Rate)
    Ethernet (RJ-45 connector)
    Wireless LAN
    Ports and Expandibility
    Audio in
    Audio out
    Three USB 2.0 ports
    5-in-1 card reader
    RJ11 Modem jack
    Battery
    6.7 hours
    6 cell llithium ion
    Dimensions
    11.6" x 8.3" x 1.4" (29.64cm x 21cm x 3.56cm)
    Weight
    3.2 lbs (1.45 kg)
    Built in Extras
    Fingerprint reader
    Webcam
    Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information on it.
    ThinkPad T510 4313-CTO Windows 8 x64 - Intel Core i7-620M - NVIDIA NVS 3100M - 8GB RAM - 240GB SSD- Intel Centrino Ultimate-N 6300 - Gobi 2000.
    ThinkPad Helix 3697-CTO Windows 8.1 x64 - Intel Core i7-3667U - Intel HD Graphics 4000 - 8GB RAM- 256GB SSD - Intel Centrino Advanced-N 6205 - Ericsson C5621gw

Maybe you are looking for