I'm generating a recordset from a SQL Server (2008 R2) stored procedure that fills a ComboBox
in excel VBA.
If I run a query to get the length of each value returned from the table it looks like so:
SELECT [outcome], LEN([outcome]) AS [Length] FROM [dbo].[crl_outcome] GROUP BY [outcome]
When executing the stored procedure, I assign the recordset to a variant array, for example:
varList = oRS.GetRows()
MsgBox Len(varList(1, 0))
The MsgBox
returns the field shown in the SQL statement above that's 21 characters long in the table as being 128 characters in length with spaces making up the remaining 107 characters.
As you can see, there's no formatting being done on the value but the field in the table is specified as nchar(128)
.
Does anyone know why the each result is having spaces appended the end of them?