Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Programming > Databases > General SQL Server Support

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-05-2008, 06:22 PM
james_geissman@countrywide.com
 
Posts: n/a
ODBC mystery

There's a SP on all of our servers that includes a #temp table where
every column is varchar(255). The SP populates the table and at the
end does a select *. One column is populated from the length column
in syscolumns, which is a smallint.

The dataset is retrieved in a C++ program using ODBC. (#define
ODBCVER 0x0351 from sql.h) It does SQLGetData with a data type of
SQL_CHAR. This works fine on the SQL 2000 servers. But we have one
SQL 2005 server, and on that one, the SQLGetData for the column that
was originally numeric throws an exception, although it works if the
data type is given as SQL_REAL.

I suspect it's somehow related to ODBC version vs. SQL version. I'd
appreciate a tip on what to look for. BTW, I have SQL 2005 Express
Edition installed on my workstation (which is where I discovered
this), and the service is usually running. Also MDAC 2.8 SP1, and
ODBC version 3.525.1117.0.

Thanks,
Jim Geissman
Reply With Quote
  #2 (permalink)  
Old 09-05-2008, 10:22 PM
Erland Sommarskog
 
Posts: n/a
Re: ODBC mystery

(james_geissman@countrywide.com) writes:
> There's a SP on all of our servers that includes a #temp table where
> every column is varchar(255). The SP populates the table and at the
> end does a select *. One column is populated from the length column
> in syscolumns, which is a smallint.
>
> The dataset is retrieved in a C++ program using ODBC. (#define
> ODBCVER 0x0351 from sql.h) It does SQLGetData with a data type of
> SQL_CHAR. This works fine on the SQL 2000 servers. But we have one
> SQL 2005 server, and on that one, the SQLGetData for the column that
> was originally numeric throws an exception, although it works if the
> data type is given as SQL_REAL.


And the error message is?

And the column you are having problem with is the one with
syscolumns.length?


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #3 (permalink)  
Old 09-06-2008, 05:22 AM
james_geissman@countrywide.com
 
Posts: n/a
Re: ODBC mystery

> And the error message is?
>
> And the column you are having problem with is the one with
> syscolumns.length?
>
> Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se


Thanks, Erland.

I'm not sure about the error message. I'll see if I can identify it
on Monday. It throws a C++ exception, which is caught several levels
above the ODBC wrapper object, so I may need to add some code to catch
it in the procedure that calls SQLGetData.

And yes, it's the column filled with syscolumns.length.

Jim
Reply With Quote
  #4 (permalink)  
Old 09-06-2008, 10:12 AM
Erland Sommarskog
 
Posts: n/a
Re: ODBC mystery

(james_geissman@countrywide.com) writes:
> I'm not sure about the error message. I'll see if I can identify it
> on Monday. It throws a C++ exception, which is caught several levels
> above the ODBC wrapper object, so I may need to add some code to catch
> it in the procedure that calls SQLGetData.


My experience is that getting hold of the actual error message is
essential to resolves such issues effeciently. Without a good error
message you are just fumbling around in completely dark room.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #5 (permalink)  
Old 09-08-2008, 10:04 PM
james_geissman@countrywide.com
 
Posts: n/a
Re: ODBC mystery

The SQL return code is 0 or SUCCESS. But somewhere between that point
and returning to the calling code C++ throws an exception, which I
haven't been able to identify yet (don't know what type of
exception). I'll let you know if I learn more.

Jim
Reply With Quote
  #6 (permalink)  
Old 09-08-2008, 10:34 PM
Erland Sommarskog
 
Posts: n/a
Re: ODBC mystery

(james_geissman@countrywide.com) writes:
> The SQL return code is 0 or SUCCESS. But somewhere between that point
> and returning to the calling code C++ throws an exception, which I
> haven't been able to identify yet (don't know what type of
> exception). I'll let you know if I learn more.


So it is likely to be a C++ problem. Not sure that I can help there. :-)


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Programming > Databases > General SQL Server Support


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:19 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
MPAA | Mortgages | Advertising | Remortgages | Send Money Online



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114