Sql Server Odbc truncate strings

Posted on 2005-03-09
Medium Priority
Last Modified: 2012-08-13

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.
Question by:ruvik
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 18

Expert Comment

ID: 13494996
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",

Author Comment

ID: 13495332
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.
LVL 11

Accepted Solution

Otana earned 750 total points
ID: 13495771
It might be a problem in your Stored Procedure. Have you tested it in the Query Analyzer?

Author Comment

ID: 13496541
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.
LVL 11

Expert Comment

ID: 13496675
Thnx. That's what I thought might have happened. Happens to me all the time :o)

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question