Re: ADO return varchar string with space trimmed
- From: wdwedw <wdwedw@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Jul 2005 11:15:03 -0700
Cast to char(10) work. Can you explain why? any documentation link?
But using varchar also working in different database. Is that a SQL server
config problem?
"Daniel Crichton" wrote:
> wdwedw wrote on Thu, 28 Jul 2005 12:42:10 -0700:
>
> > I have a stored procedure like this:
> > select CASE WHEN LEN(D1) < = 10
> > THEN D1 + REPLICATE(' ', 10 - len(D1))
> > ELSE LEFT(D1,10)
> > END AS D1
> > from table1
> >
> > When ADO retrieved the record in VB, the appended spaces were trimmed! I
> > can work around with REPLICATE(N' ', 10 - len(D1)). But what's wrong?
>
> A varchar defined field will strip appended spaces. CAST it as a char(10)
> and the spaces will remain.
>
> Dan
>
>
>
.
- References:
- ADO return varchar string with space trimmed
- From: wdwedw
- Re: ADO return varchar string with space trimmed
- From: Daniel Crichton
- ADO return varchar string with space trimmed
- Prev by Date: When to switch from SWITCH() to JOIN
- Next by Date: Slow Stored Procedure when run via ado, fast from query analyzer
- Previous by thread: Re: ADO return varchar string with space trimmed
- Next by thread: When to switch from SWITCH() to JOIN
- Index(es):
Relevant Pages
|
|