Unix Technical Forum

wrong column size with SQLDescribeCol

This is a discussion on wrong column size with SQLDescribeCol within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> To dynamically set the length of a variable (Code in C) to store data, i use the ODBC API ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 09:56 PM
mlu
 
Posts: n/a
Default wrong column size with SQLDescribeCol

To dynamically set the length of a variable (Code in C) to store data,
i use the ODBC API function SQLDescribeCol. When a smalldatetime column
type from SQLServer is treat by SQLDescribeCol, the COLSIZE return by
the function is 16 when YYYY-MM-DD HH:MM:SS contain 19 characters. This
case overload my variable with a crashing result of my program.

Is it a known problem and how can it be fixed?

Thank you!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 09:56 PM
Sophie Guo [MSFT]
 
Posts: n/a
Default RE: wrong column size with SQLDescribeCol

Hello,

It seems to be driver related issue. I'd like to confirm that the data
source is a SQL server database. If so, I suggest that you upgrade to the
latest MDAC and check the issue again:

MDAC Downloads
http://msdn.microsoft.com/data/mdac/...s/default.aspx

How to obtain the latest MDAC 2.8 service pack
http://support.microsoft.com/default...b;en-us;884103

I hope the information is helpful.

Sophie Guo
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security

================================================== ===
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 09:56 PM
Igor Shekalev
 
Posts: n/a
Default Re: wrong column size with SQLDescribeCol

Try to use SQLColAttributes API call with SQL_DESC_DISPLAY_SIZE parameter.

m> To dynamically set the length of a variable (Code in C) to store
m> data, i use the ODBC API function SQLDescribeCol. When a
m> smalldatetime column type from SQLServer is treat by SQLDescribeCol,
m> the COLSIZE return by the function is 16 when YYYY-MM-DD HH:MM:SS
m> contain 19 characters. This case overload my variable with a crashing
m> result of my program.

Igor Shekalev, www.sqledit.com - powerful database tools


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:25 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com