Solved

how to use trim in access 2013 to cut extra spaces

Posted on 2014-01-12
6
1,096 Views
Last Modified: 2014-01-12
hi

i have some strange problem that when i make with a query for example:
NSERT INTO IskitTemp ( ProductName ) Select ProductName From ProductTbl

Open in new window

i get a list with  all products name with extra spaces that increase the character in the productName field to  250 characters (like the Restriction of The maximum amount of characters that can stored in the product name in the producttbl, but in the producttbl it's dosn't have so much  spaces  so why in iskittemp is so much spaces ?
0
Comment
Question by:bill201
  • 3
  • 3
6 Comments
 
LVL 48

Expert Comment

by:Rgonzo1971
Comment Utility
HI,

whitout more info about IsKitTemp

pls try

INSERT INTO Trim(IskitTemp ( ProductName ) )Select ProductName From ProductTbl 

Open in new window

Regards
0
 

Author Comment

by:bill201
Comment Utility
there is something wrong in your code, it's not working and i get an error message
0
 
LVL 48

Expert Comment

by:Rgonzo1971
Comment Utility
Hi,

What is Definition of Product Name In the ProductTbl?

EDIT Are you using VARCHAR(n)  because CHAR(n) will add blanks at the end?

INSERT INTO IskitTemp ( ProductName ) Select Trim(ProductName) From ProductTbl 

Open in new window


Regards
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:bill201
Comment Utility
i create it with sql string :

the Definition of Product Name In the ProductTbl is short text field size (255)

the iskttemp i create with a sql string like this
CREATE TABLE  (ProductName CHAR (255))

Open in new window

0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
Hi,

With CHAR it adds Blank Space to create a 255 Character Long Field, pls use VARCHAR

Regards
0
 

Author Comment

by:bill201
Comment Utility
thanks a lot, now there is no problem
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Creating and Managing Databases with phpMyAdmin in cPanel.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

15 Experts available now in Live!

Get 1:1 Help Now