-
[varchar] (100) and empty space
Hello
I am creating the following table
CREATE TABLE [dbo].[myT] (
[name] [varchar] (100) NULL
)
if I do
INSERT INTO myT (name) VALUES ('A')
i get in the table a column with
A ...
the 100 char place is full even if there is a data with only 1 char
how is it possible to avoid it ?
I want 100 char maximum but not full with nothing
thank you for helping
-
On which rdbms? How do you know it uses 100 bytes?
-
run this command
select datalength(name) from myT
-
I am getting 200
2 time the normal size !
-
r u sure you are querying the right table?
This is what i got
CREATE TABLE [dbo].[myT] ([name] [varchar] (100) NULL )
INSERT INTO myT (name) VALUES ('A')
select datalength(name) from myT
--result 1
-
sorry ! that field is nvarchar and I get 200 for [name] [nvarchar] (100) NULL
if i run the code
CREATE TABLE [dbo].[myT] ([name] [varchar] (100) NULL )
INSERT INTO myT (name) VALUES ('A')
select datalength(name) from myT
i get also 1
but I don't understand from where are coming in my table the blanks char
each column = any(----------long space-------)
the datalength allways= 100
Last edited by anselme; 05-22-2007 at 02:46 PM.
-
Double check your table schema and how inserted values.
-
I have inserted values with a @parameter char(100) !
:-(
now it works
thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|