473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

trim spaces

i have this sql statement and i want to trim off any leading spaces, how i do that
Expand|Select|Wrap|Line Numbers
  1. SELECT tbl_Bills.[DATE ENT] AS DATE_ENT, tbl_Bills.[Date] AS SHIP_DATE, dbo.tbl_Bills.CARRIER, dbo.tbl_Bills.PRO, dbo.tbl_bills.spec_fedinv, dbo.tbl_Bills.SHIPPER, dbo.tbl_Bills.CONS, dbo.tbl_Bills.F_B, dbo.tbl_Bills.LOC, dbo.tbl_Bills.PCS, dbo.tbl_Bills.WT, dbo.tbl_Bills.NET_CHGS, tbl_Bills.[DATE PAID] AS DATE_PAID, tbl_Bills.[CK NO] AS CK_NO FROM dbo.tbl_Bills INNER JOIN dbo.[tbl_Bills LOCATIONS] ON dbo.tbl_Bills.[Customer Name] = dbo.[tbl_Bills LOCATIONS].[Customer Name] AND dbo.tbl_Bills.LOC = dbo.[tbl_Bills LOCATIONS].[WD LOCATION]
Oct 1 '15 #1
5 1323
Rabbit
12,516 Expert Mod 8TB
Depending on what database you're using, you can use either the TRIM() or LTRIM() functions on the fields you want to trim.
Oct 1 '15 #2
so i would just do this?

Expand|Select|Wrap|Line Numbers
  1.  trim(dbo.tbl_Bills.CARRIER)
when i did that before it didnt like that.
Oct 2 '15 #3
madankarmukta
308 256MB
bills.CARRIER - what is the datatype of this. Seems to be of the type string. If so, as Rabbit suggested depending on the Database you can use TRIM or LTRIM functions.

Hope this resolves your problem.
Oct 2 '15 #4
i am pulling this field from my ms access database, tbl_bills is the table in my dbo and carrier is the field in that table. when i put the whole thing in

Expand|Select|Wrap|Line Numbers
  1.  trim(dbo.tbl_bills.carrier) 
it does not like that
Oct 2 '15 #5
Rabbit
12,516 Expert Mod 8TB
What do you mean it doesn't like it? You need to be more specific. And please post the full updated code.
Oct 2 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: John A Grandy | last post by:
What's the proper way to write a validation regex so that all leading and trailing spaces are trimmed before evaluation ? Thanks.
2
by: rsine | last post by:
I am developing a program that requires me to read a string of data from a text field in a database. Data is parsed from the string based upon a starting position/length. If a piece of data...
11
by: Darren Anderson | last post by:
I have a function that I've tried using in an if then statement and I've found that no matter how much reworking I do with the code, the expected result is incorrect. the code: If Not...
0
by: Feng | last post by:
We just noticed a strange behavior of our VB.net app. We have a dataset containing a string field which contains a space, " " (please note here, it is not ""!). When we send this dataset accross...
5
by: sandeepk84 | last post by:
hi all.. i have a doubt...how we can remove blank spaces in a column value while retrieving? i tried using LTRIM(RTRIM(COLUMN NAME))... But it's removing only the leading and trailing...
8
by: Michael786 | last post by:
Hi. I am using access 97 and am trying to run a query that will crunch up all data in a field and thus removing all spaces. For example I have a field called Address1: Example data: 12 Murray...
5
by: Andrew Wingorodov | last post by:
im made subj like this: inline bool isnt_space (int sp) { return (::isspace (sp)) ? false : true; } str.erase ( std.begin () , std::find_if ( str.begin(), str.end(), isnt_space) );
2
by: Andrew Poulos | last post by:
White space includes \t\r\n\v\f. I wrongly took it to mean just spaces " " so when I ran the 'trim' function it stripped some of my formatting. Perhaps the FAQ item should either include a...
5
by: Marjeta | last post by:
I'm trying to very that the user actually entered something in the form, and not just spaces. I guess the problem is in the first line of isBlank() function. I've tried the following:...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.