SQL Server error - Cannot call methods on nchar.

Posted on 2011-04-25
Last Modified: 2012-05-11
This part of my select is causing the 'Cannot call methods on nchar':

How can I trim this field?
Question by:JT_SIRO
    LVL 67

    Expert Comment

    Columns are no objects you can apply methods to. You have to use functions with columns as arguments.
    LVL 19

    Accepted Solution

    Use this

    Open in new window

    LVL 67

    Assisted Solution

    Blimey, yes, there is no TRIM, only LTRIM and RTRIM.
    LVL 75

    Expert Comment

    by:Anthony Perkins
    The author is refering to the Trim method in .NET and not T-SQL.  Having said that, nchar by definition will always have trailing spaces at the end.  If you do not want that, then you will have to change the data type to nvarchar.
    LVL 75

    Expert Comment

    by:Anthony Perkins
    Nevermind.  It looks like I am the one that misread that they are in fact trying to use T-SQL.  Sorry for the confusion.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Viewers will learn how the fundamental information of how to create a table.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now