Monday, February 20, 2012

Problem inserting data in SQL express

Hello everybody

I'm working with a database and trying to add data to the database with the next stameny:

INSERT INTO table VALUES ('value1')

but the result of doing this, even with the Management studio, is the value value1 with one space at the end. It is like 'value1 '

Any clue?

Thank you very much and greetings from spain.

Santiago

Hi,

Most likely your field declared as CHAR(7), not VARCHAR(7). Length of your string is 6 characters and for the CHAR types SQL Server fills rest of the string with the spaces. This is by-design. If you need a value without spaces, then you would need to use VARCHAR type for this field

|||Thank you very much for the help, problem solved.

No comments:

Post a Comment