Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TQuery.open operating on stored proc skips all null columns in result set



Permlink Replies: 1 - Last Post: May 16, 2016 1:29 AM Last Post By: Andy Stobirski
Andy Stobirski

Posts: 18
Registered: 6/12/16
TQuery.open operating on stored proc skips all null columns in result set
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 12, 2016 1:28 AM
Hi Guys

I've inherited some old code that uses Borland C++ Builder v5.0 (Build 12.34). Previously, it was being maintained, but now it's being upgraded and modified. I have some experience of C++ but work mainly in C#.

Basically, I have a stored procedure which is being opened as per the code below, and it works without error. However, in the resultant recordset entire columns are omitted if all of the rows contained within are nulls. The presence of a non-null row any where in that column will cause it to be returned.

Interestingly, the property FieldDefList for LoadQuery (see below) returns all the columns that we expect the SP to return.

Within the SP, we have tried using table variables, temp tables and real tables but no joy.


TQuery *LoadQuery;
 
//snip
 
LoadQuery->SQL->Clear();
 
LoadQuery->Add("spLogin 'someUserName','somepassword'");
 
LoadQuery->Open();
 
//always runs without error, but all null columns skipped
 


The code is running on Windows 7, and is using SQL Server 2008 r2.

Edited by: Andy Stobirski on May 12, 2016 1:28 AM
Andy Stobirski

Posts: 18
Registered: 6/12/16
Re: TQuery.open operating on stored proc skips all null columns in result set
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 16, 2016 1:29 AM   in response to: Andy Stobirski in response to: Andy Stobirski
Aha - solved it! The stored procedure being referenced returned NVARCHAR columns,when these were changed to VARCHAR everything worked as as expected.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02