Solved

Using Trim Function in SQL Server SQL Statement

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

757 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

17 Experts available now in Live!

Get 1:1 Help Now