• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1216
  • Last Modified:

how to use trim in access 2013 to cut extra spaces

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
bill201
Asked:
bill201
  • 3
  • 3
1 Solution
 
Rgonzo1971Commented:
HI,

whitout more info about IsKitTemp

pls try

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

Open in new window

Regards
0
 
bill201Author Commented:
there is something wrong in your code, it's not working and i get an error message
0
 
Rgonzo1971Commented:
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
bill201Author Commented:
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
 
Rgonzo1971Commented:
Hi,

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

Regards
0
 
bill201Author Commented:
thanks a lot, now there is no problem
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now