Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Using Trim Function in SQL Server SQL Statement

Posted on 2008-06-18
1
825 Views
Last Modified: 2008-06-18
I have use the trim function as part of SQL statements when reading data from a MS Access database.   I have used this as part of search criteria in the SQL statement to make sure that any random spaces are removed so that matches are found.   I am trying to read data from a SQL Server database and the trim function does not work because it is not a built in function.  Is their any equivalent to the trim function that can be used with SQL server.   An example of what i have used with access databases is as follows:

SELECT * from tblInfo where Trim(Rec_ID) = '" & sCrit & "'"
0
Comment
Question by:Mike_Stevens
1 Comment
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 21812087
SQL Server uses LTRIM and RTRIM to remove leading/trailing spaces, respectively.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

829 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