Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Stoping extra white space.

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-08-13 : 23:25:43
I have notice that when I pull data out of my table there is extra white space after the normal text. (I.E. I input "Text" and when it is pulled out it is "Text ") I know in my ASP and Perl scripts I can remove the extra white space but is there a way to simply prevent the extra white space from appearing in MS SQL 2k?

Table design code:

CREATE TABLE [real_info] (
[uid] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[age] [numeric](3, 0) NOT NULL CONSTRAINT [DF_real_info_age] DEFAULT ((-1)),
[real_name] [char] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[city] [char] (25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_real_info_city] DEFAULT ('Unkown'),
[country] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_real_info_country] DEFAULT ('Unkown'),
[sex] [char] (7) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_real_info_sex] DEFAULT ('Unknown'),
CONSTRAINT [PK_real_info] PRIMARY KEY CLUSTERED
(
[uid]
) ON [PRIMARY]
) ON [PRIMARY]


Note: This creation code is generated by SQL Query Analizer and not me so do not take it as a mesorment of my SQL programing abilities. I still do most things in Enterprize Maniger.

--
If I get used to enving others...
Those things about my self I pride will slowly fade away.
-Stellvia

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-08-13 : 23:37:25
Read the difference between CHAR and VARCHAR in Books Online, that will explain it well.
Also, you can use Trim() in your ASP.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-08-14 : 09:08:03
quote:
Originally posted by Merkin

Read the difference between CHAR and VARCHAR in Books Online, that will explain it well.
Also, you can use Trim() in your ASP.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson


I am currently using trim() in my ASP and the regex s/\s+// in my perlscript. I have read up and vchar and char and do use vchar sometimes but from what I understood from books online is that you should only use vchar when you explice the leng of text to vary alot.

--
If I get used to enving others...
Those things about my self I pride will slowly fade away.
-Stellvia
Go to Top of Page
   

- Advertisement -