473,322 Members | 1,409 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,322 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 1320
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.