473,406 Members | 2,698 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,406 software developers and data experts.

Double space replaced with single space by dbms ??!

This is driving me bananas. Can't find any info on this anywhere....
SQL 2000 seems to replace double space with a single space when I set
a varchar field to " " (2spaces), it only stores " " (1space). Why
on earth would microsoft do this? If I save 2 spaces - I WANT TO SEE
2 SPACES!!!!

Can anyone help? Is this a database setting? Is this due to using
varchar?

Any help appreciated.

Colin Hale
Jul 20 '05 #1
2 4789
[posted and mailed, please reply in news]

Colin Hale (co*******@radiusplc.co.uk) writes:
This is driving me bananas. Can't find any info on this anywhere....
SQL 2000 seems to replace double space with a single space when I set
a varchar field to " " (2spaces), it only stores " " (1space). Why
on earth would microsoft do this? If I save 2 spaces - I WANT TO SEE
2 SPACES!!!!

Can anyone help? Is this a database setting? Is this due to using
varchar?


Could you please post a repro that demonstrates the problem? That is
a script with a CREATE TABLE statement, INSERT statements of the data.
Or if you add the data through some client code, please include
that client code.

I get double spaces from this script:

CREATE TABLE a(a varchar(10))
go
INSERT a VALUES ('a a')
go
select * from a

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
It is trailing spaces that are the problem.
However I have found the answer Microsoft Knowledge Base Article -
296559. Even though ansi padding set to on for the database, once an
ALTER COLUMN command has been issued against the column, ansi padding
is then switched off !!! Seems the only way around this is to
recreate the table and transfer the data, unless anyone else has any
ideas?
Jul 20 '05 #3

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

Similar topics

3
by: Matthew Sims | last post by:
Hey all, So I started using nl2br and love it. But when I convert back from <br> to \n, it produces double spaces instead of single space. Converting \n to <br>: $emailBody=nl2br($_POST);...
1
by: CODA PBC | last post by:
We have one user who enters a transaction and then does a single row update (updates all columns but only one is changing - this is due to the way our sql is generated in the application), at this...
1
by: davegraham_1998 | last post by:
Hi All- I'm pretty sure this have been discussed earlier, but couldn't find a solution to my problem. <input type="submit" value="Delete Parts" onclick="return handleDeleteParts('ABC', 'MY...
5
by: Alex Vassiliev | last post by:
Hi all. Just wanted to share two handy RegEx expressions to strips leading and trailing white-space from a string, and to replace all repeated spaces, newlines and tabs with a single space. *...
16
by: Charles Law | last post by:
I have a string similar to the following: " MyString 40 "Hello world" all " It contains white space that may be spaces or tabs, or a combination, and I want to produce an array...
60
by: Erick-> | last post by:
hi all... I've readed some lines about the difference between float and double data types... but, in the real world, which is the best? when should we use float or double?? thanks Erick
6
by: Benjamin Janecke | last post by:
Hi, I have to call a java-written soap webservice from a .NET client application. Unfortunately, the URL contains of a double slash "//", as u can see in this example: ...
3
by: Eric Layman | last post by:
Hi, I've saved data into the db by doing a replace() on single quote. Right now on data display on a datagrid, it shows double single quote. How do I make changes during run time of datagrid...
3
by: Stef Mientki | last post by:
It looks like sometimes a single backslash is replaced by a double backslash, but sometimes it's not ??? See the error message below, the first backslash is somewhere (not explicitly in my code)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.