Re: ADO return varchar string with space trimmed



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


.



Relevant Pages

  • Re: Returning a "Table" type from a stored procedure
    ... >I am trying to create a stored procedure that has both input and output ... > SELECT * FROM Table1 ... David ... Prev by Date: ...
    (microsoft.public.dotnet.framework.adonet)
  • stored procedure help.
    ... i want to write stored procedure in sql server to insert values into ... instead of table1 i want to user variable name. ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: public role question
    ... I didn't understand what Dan was asking me to do. ... Then I am able to create a stored procedure. ... system tables with select permissions. ... You ARE the special DBO user, and not the new user, which is why you have ...
    (microsoft.public.sqlserver.security)
  • Re: public role question
    ... Dan, I'm sorry but after I responded to Kalen's email I deleted the test ... Somehow the user 'dantest' was the owner of the database so I guess ... I did create a second user with only the public role for permissions and was ... Then I am able to create a stored procedure. ...
    (microsoft.public.sqlserver.security)
  • Re: public role question
    ... The user dbo is a privileged user and can create tables and procs, ... permissions from the user dbo. ... "Dan Guzman" wrote: ... Why am I able to create a stored procedure with the new user. ...
    (microsoft.public.sqlserver.security)