473,785 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preventing End of String Spaces in Appended Column in Table

Hello,

Using ADO I have created a table and have also created fields.

To create fields, I have used the following:

..Columns.Appen d "Field_Name ", adWChar, 6

I load records into this created table including into this field.

I notice that if the value that I load into this field is less than
the full defined length of 6 chars, the balance is padded with spaces.

For example in this 6 length Char field, if I want to load the value
"APP1" then what really gets loaded is "APP1 " which has 2 spaces
padded at the end.

The value "APP1" is contained in another field and definitely has NO
padded spaces at the right. Even using something like:

!Field_Name = Trim(Another_fi eld)

does not help.

Any suggestions?

Thanks in advance.

Uttam
Nov 12 '05 #1
3 2061
I think you need to specify varchar, not char.

On 8 Nov 2003 12:03:52 -0800, u0***@hotmail.c om (Uttam) wrote:
Hello,

Using ADO I have created a table and have also created fields.

To create fields, I have used the following:

.Columns.Appen d "Field_Name ", adWChar, 6

I load records into this created table including into this field.

I notice that if the value that I load into this field is less than
the full defined length of 6 chars, the balance is padded with spaces.

For example in this 6 length Char field, if I want to load the value
"APP1" then what really gets loaded is "APP1 " which has 2 spaces
padded at the end.

The value "APP1" is contained in another field and definitely has NO
padded spaces at the right. Even using something like:

!Field_Name = Trim(Another_fi eld)

does not help.

Any suggestions?

Thanks in advance.

Uttam


Nov 12 '05 #2
On 8 Nov 2003 12:03:52 -0800, u0***@hotmail.c om (Uttam) wrote:

Varchar data types don't offer this 'feature'.
-Tom.

Hello,

Using ADO I have created a table and have also created fields.

To create fields, I have used the following:

.Columns.Appen d "Field_Name ", adWChar, 6

I load records into this created table including into this field.

I notice that if the value that I load into this field is less than
the full defined length of 6 chars, the balance is padded with spaces.

For example in this 6 length Char field, if I want to load the value
"APP1" then what really gets loaded is "APP1 " which has 2 spaces
padded at the end.

The value "APP1" is contained in another field and definitely has NO
padded spaces at the right. Even using something like:

!Field_Name = Trim(Another_fi eld)

does not help.

Any suggestions?

Thanks in advance.

Uttam


Nov 12 '05 #3
Sorry everyone - I guess I need to gain more confidence i my own
abilities!

I have found the solution myself and this is the way -

tbl.Columns.Ite m(0).Properties .Item(3).Value = True

The Item(0) refers to the field number in my table definition. For
example in my table field No 1 is the one where I want to have not
fixed length but length depending on the value of the field. Hence
Item(0).

Properties.item (3) refers to the "adColNulla ble" Property of the
column - that is Fixed length or actual length of the data. I have
simply set it to true.

Thanks to all those who tried to help.

Cheers!

Uttam
=============== ============

Tom van Stiphout <to*****@no.spa m.cox.net> wrote in message news:<96******* *************** **********@4ax. com>...
On 8 Nov 2003 12:03:52 -0800, u0***@hotmail.c om (Uttam) wrote:

Varchar data types don't offer this 'feature'.
-Tom.

Hello,

Using ADO I have created a table and have also created fields.

To create fields, I have used the following:

.Columns.Appen d "Field_Name ", adWChar, 6

I load records into this created table including into this field.

I notice that if the value that I load into this field is less than
the full defined length of 6 chars, the balance is padded with spaces.

For example in this 6 length Char field, if I want to load the value
"APP1" then what really gets loaded is "APP1 " which has 2 spaces
padded at the end.

The value "APP1" is contained in another field and definitely has NO
padded spaces at the right. Even using something like:

!Field_Name = Trim(Another_fi eld)

does not help.

Any suggestions?

Thanks in advance.

Uttam

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
25376
by: epaetz | last post by:
I'm doing a bcp out of a table to a file. Some of the fields in a record may have an empty string. When I bcp out to the file and examine it, the fields that have an empty string in the database now show up in the file as having one blank character. Why is bcp doing this? I don't want the blank character in my output. Thanks,
7
7422
by: ITM | last post by:
Can anyone tell me how I can prevent Access adding trailing spaces when I insert a value into a Text column? For example, if I execute the following statement: UPDATE Log SET Log.Title = 'Testing' WHERE Log.Identifier=1; ....then the following statement:
1
1775
by: windandwaves | last post by:
Hi Folk I am working with the TYPE property. I want to change that from 2 (byte) to 4 (long integer) for a field that already contains tons of data. How can I do that? The help reads: For a Field or Property object, this property is read/write until the object is appended to a collection or to another object, after which it's
2
2047
by: adambossy | last post by:
I have a nasty situation in SQL Server 7.0. I have a table, in which one column contains a string-delimited list of IDs pointing to another table, called "Ratings" (Ratings is small, containing less than ten values, but is subject to change.) For example: 1/Bronze 2/Silver 3/Gold 4/Platinum
26
3206
by: Hardy Wang | last post by:
Hi all, I know it is better to handle large string with a StringBuilder, but how does StringBuilder class improve the performance in the background? Thanks! -- WWW: http://hardywang.1accesshost.com ICQ: 3359839 yours Hardy
10
39138
by: satishrajana | last post by:
Hi, My SQL returns a NULL in a datefield if there is no date in that field. If there is a NULL in this column, I want to replace it with spaces in my SELECT statement when I am selecting these records. Can any of you experts out there help me with a sample SQL.
3
3775
by: ShaeMills via AccessMonster.com | last post by:
In my table I imported from .txt, one of my columns has blank spaces. The column is as follows, how do I eliminate the blank spaces in between the second and third, and fifth and sixth digits? 12 345 6789 78 241 5869 04 258 3695 14 254 1136 00 045 0285
5
4398
by: Rahul | last post by:
Friends, My Problem is related to writing a text file from a database using .Net. in a particular string format. I have a dataset with a table, let suppose in this table there are three fields. - Code - Description - Amount
2
14199
by: Jay | last post by:
I have a SQL Server table with nvarchar type column which has not null constraint. I am inserting empty string ("") from Java to the table column. When I export this table into .csv file using bcp tool, empty string gets written as NUL character. Is there any way I can bcp out empty string as empty string itself instead of NUL to the file? The bcp command I used to export table into csv file is bcp "SELECT...
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10346
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.