Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 382
  • Last Modified:

Sql Server Odbc truncate strings

Hi,

I have a stored procedure in Sql Server returning varchar with maximum length of 50.
I define an OdbcParameter with direction equals to returnValue, and after executing the stored procedure, the value shows only the first character, which was truncated.
Im using Microsoft SQL Server ODBC Driver Version 03.85.1025.
When i use the same code with an equivalent Oracle stored procedure it works fine.

Any help is appreciated.
0
ruvik
Asked:
ruvik
  • 2
  • 2
1 Solution
 
testnCommented:
when you create a return odbc parameter, you can explicit define type of return parameter... something like this (not sure about syntax)

yourcommand.Parameters.Add(new OdbcParameter("RETURN_VALUE",
        OdbcType.VarChar,50,ParameterDirection.ReturnValue));
0
 
ruvikAuthor Commented:
Yes I know that and Ive already tried all the text like types (just in case), but none did the trick.
No matter the parameter type, it always truncates the entire string but the first character.
0
 
OtanaCommented:
It might be a problem in your Stored Procedure. Have you tested it in the Query Analyzer?
0
 
ruvikAuthor Commented:
stupied me! since im new to sql server i returned type varchar instead of varchar(50).
Otana, i will accept your answer only because you made me look again in the query analyzer and discover my stupidity.
0
 
OtanaCommented:
Thnx. That's what I thought might have happened. Happens to me all the time :o)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now