Solved

Using Trim Function in SQL Server SQL Statement

Posted on 2008-06-18
1
823 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

863 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

20 Experts available now in Live!

Get 1:1 Help Now