Results 1 to 3 of 3
  1. #1
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313

    Detecting Trailing Spaces in a nvarchar Field

    I have a table on SQL Server with fields defined as type nvarchar(255). Some of the rows have data with trailing spaces in that field. I don't know how they got there, but I identified them with a SQL Server query using the DATALENGTH function. How can I do the same thing with an Access query. When I use the LEN function, it automatically excludes the trailing spaces. Thanks.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    if right([field],1) = " "

    to remove:
    trim([field])

  3. #3
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313
    That worked. Thanks.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 01-30-2014, 10:55 AM
  2. Replies: 1
    Last Post: 07-12-2013, 04:43 AM
  3. Trailing Spaces workaround
    By shexe in forum Queries
    Replies: 23
    Last Post: 09-21-2010, 04:28 AM
  4. Find Spaces in Field
    By stottle in forum Queries
    Replies: 6
    Last Post: 08-17-2009, 02:02 AM
  5. Replies: 9
    Last Post: 07-16-2009, 09:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums