Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field storing non-existant spaces 1

Status
Not open for further replies.

rickyoswaldiow

Programmer
Jul 16, 2007
127
GB
For some reason, a field I've recently created to store a web address is full of spaces as default... I can write a value to the field from VBA such as but it then stores it with dozens of spaces after the address!
 
Fixed.
I had the field set to char with not null, I simply changed it to nvarchar and put the default value ('')
 
The other way to remove the spaces is use "Trim()" when you pull the data. (RTRIM() for MS SQL server)


With Data type Char(10), 10 spaces are allocated for that location.

In the fields you have "AB "

SELECT MyField FROM MyTable returns "AB "

SELECT TRIM(MyField)FROM MyTable returns "AB"




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top