How to get all data as it is available from SQLServer
I'm trying to get data from SQLSERVER using TADOQUERY linked to my database , using this request
declare @num_p varchar(9)
declare cur1 cursor for select do_piece from F_DOCENTETE where (DO_Piece like ('____00')or DO_Piece like ('____A0')or DO_Piece like ('____B0')
or DO_Piece like ('____B0')or DO_Piece like ('____C0') OR DO_Piece like ('____D0')OR DO_Piece like ('____E0')OR DO_Piece like ('____F0')OR DO_Piece like ('____G0')
OR DO_Piece like ('____H0')OR DO_Piece like ('____I0')OR DO_Piece like ('____J0')OR DO_Piece like ('____K0')OR DO_Piece like ('____L0')OR DO_Piece like ('____M0')
OR DO_Piece like ('____N0')OR DO_Piece like ('____O0')OR DO_Piece like ('____P0')OR DO_Piece like ('____Q0')OR DO_Piece like ('____R0')OR DO_Piece like ('____S0')
OR DO_Piece like ('____T0')OR DO_Piece like ('____U0')OR DO_Piece like ('____V0')OR DO_Piece like ('____W0')OR DO_Piece like ('____X0')OR DO_Piece like ('____Y0')
OR DO_Piece like ('____Z0')OR DO_Piece like ('____D0'))and DO_Date between ('01/01/2018') and('31/12/2018') and do_type in ('16','17')
open cur1
fetch cur1 into @num_p
while @@FETCH_STATUS=0
begin
select f_docligne.do_piece,f_docligne.ct_num,F_COMPTET.CT_Intitule,AR_Ref, DL_Design,DL_Qte, DL_PrixUnitaire,DL_PUDevise,DL_Frais,DL_PUTTC, DL_MontantHT,
DL_MontantTTC,DO_Ventile,DO_Cours,f_docligne.do_date from F_DOCLIGNE,F_DOCENTETE,F_COMPTET
WHERE f_docligne.DO_Piece=F_DOCENTETE.DO_Piece and F_DOCLIGNE.DO_Type=F_DOCENTETE.DO_Type and f_docligne.CT_Num=F_DOCENTETE.DO_Tiers
and F_DOCENTETE.DO_Tiers=F_COMPTET.CT_Num and f_docligne.DO_Piece like((select LEFT(@num_p,5))+'_') order by f_docligne.DO_Piece
fetch cur1 into @num_p
end
close cur1
deallocate cur1
the problem is that in sqlserver i see all records while fetching
but in delphi app it returns only last fetch , so how can i get it as SQLSERVER doest , shows data as it is displayed
sql sql-server database delphi ado
|
show 4 more comments
I'm trying to get data from SQLSERVER using TADOQUERY linked to my database , using this request
declare @num_p varchar(9)
declare cur1 cursor for select do_piece from F_DOCENTETE where (DO_Piece like ('____00')or DO_Piece like ('____A0')or DO_Piece like ('____B0')
or DO_Piece like ('____B0')or DO_Piece like ('____C0') OR DO_Piece like ('____D0')OR DO_Piece like ('____E0')OR DO_Piece like ('____F0')OR DO_Piece like ('____G0')
OR DO_Piece like ('____H0')OR DO_Piece like ('____I0')OR DO_Piece like ('____J0')OR DO_Piece like ('____K0')OR DO_Piece like ('____L0')OR DO_Piece like ('____M0')
OR DO_Piece like ('____N0')OR DO_Piece like ('____O0')OR DO_Piece like ('____P0')OR DO_Piece like ('____Q0')OR DO_Piece like ('____R0')OR DO_Piece like ('____S0')
OR DO_Piece like ('____T0')OR DO_Piece like ('____U0')OR DO_Piece like ('____V0')OR DO_Piece like ('____W0')OR DO_Piece like ('____X0')OR DO_Piece like ('____Y0')
OR DO_Piece like ('____Z0')OR DO_Piece like ('____D0'))and DO_Date between ('01/01/2018') and('31/12/2018') and do_type in ('16','17')
open cur1
fetch cur1 into @num_p
while @@FETCH_STATUS=0
begin
select f_docligne.do_piece,f_docligne.ct_num,F_COMPTET.CT_Intitule,AR_Ref, DL_Design,DL_Qte, DL_PrixUnitaire,DL_PUDevise,DL_Frais,DL_PUTTC, DL_MontantHT,
DL_MontantTTC,DO_Ventile,DO_Cours,f_docligne.do_date from F_DOCLIGNE,F_DOCENTETE,F_COMPTET
WHERE f_docligne.DO_Piece=F_DOCENTETE.DO_Piece and F_DOCLIGNE.DO_Type=F_DOCENTETE.DO_Type and f_docligne.CT_Num=F_DOCENTETE.DO_Tiers
and F_DOCENTETE.DO_Tiers=F_COMPTET.CT_Num and f_docligne.DO_Piece like((select LEFT(@num_p,5))+'_') order by f_docligne.DO_Piece
fetch cur1 into @num_p
end
close cur1
deallocate cur1
the problem is that in sqlserver i see all records while fetching
but in delphi app it returns only last fetch , so how can i get it as SQLSERVER doest , shows data as it is displayed
sql sql-server database delphi ado
Please show your Delphi code
– Keith Miller
Nov 12 at 10:00
Can you add some sample table data and the expected result - all as formatted text, not images.
– jarlh
Nov 12 at 10:03
like '___[0,A-Z]0'
– Ivan Starostin
Nov 12 at 10:04
1
I think you could do this in one select statement without using a cursor.
– Keith Miller
Nov 12 at 10:04
but in delphi app
because your code is returning multiple resultsets and client-side code is not ready for this. The simplest workaround: put all records into temp table during cursor processing, perform single select from it in the end. Step 2 - rewrite without cursor, step 3 - normalize your data model.
– Ivan Starostin
Nov 12 at 10:08
|
show 4 more comments
I'm trying to get data from SQLSERVER using TADOQUERY linked to my database , using this request
declare @num_p varchar(9)
declare cur1 cursor for select do_piece from F_DOCENTETE where (DO_Piece like ('____00')or DO_Piece like ('____A0')or DO_Piece like ('____B0')
or DO_Piece like ('____B0')or DO_Piece like ('____C0') OR DO_Piece like ('____D0')OR DO_Piece like ('____E0')OR DO_Piece like ('____F0')OR DO_Piece like ('____G0')
OR DO_Piece like ('____H0')OR DO_Piece like ('____I0')OR DO_Piece like ('____J0')OR DO_Piece like ('____K0')OR DO_Piece like ('____L0')OR DO_Piece like ('____M0')
OR DO_Piece like ('____N0')OR DO_Piece like ('____O0')OR DO_Piece like ('____P0')OR DO_Piece like ('____Q0')OR DO_Piece like ('____R0')OR DO_Piece like ('____S0')
OR DO_Piece like ('____T0')OR DO_Piece like ('____U0')OR DO_Piece like ('____V0')OR DO_Piece like ('____W0')OR DO_Piece like ('____X0')OR DO_Piece like ('____Y0')
OR DO_Piece like ('____Z0')OR DO_Piece like ('____D0'))and DO_Date between ('01/01/2018') and('31/12/2018') and do_type in ('16','17')
open cur1
fetch cur1 into @num_p
while @@FETCH_STATUS=0
begin
select f_docligne.do_piece,f_docligne.ct_num,F_COMPTET.CT_Intitule,AR_Ref, DL_Design,DL_Qte, DL_PrixUnitaire,DL_PUDevise,DL_Frais,DL_PUTTC, DL_MontantHT,
DL_MontantTTC,DO_Ventile,DO_Cours,f_docligne.do_date from F_DOCLIGNE,F_DOCENTETE,F_COMPTET
WHERE f_docligne.DO_Piece=F_DOCENTETE.DO_Piece and F_DOCLIGNE.DO_Type=F_DOCENTETE.DO_Type and f_docligne.CT_Num=F_DOCENTETE.DO_Tiers
and F_DOCENTETE.DO_Tiers=F_COMPTET.CT_Num and f_docligne.DO_Piece like((select LEFT(@num_p,5))+'_') order by f_docligne.DO_Piece
fetch cur1 into @num_p
end
close cur1
deallocate cur1
the problem is that in sqlserver i see all records while fetching
but in delphi app it returns only last fetch , so how can i get it as SQLSERVER doest , shows data as it is displayed
sql sql-server database delphi ado
I'm trying to get data from SQLSERVER using TADOQUERY linked to my database , using this request
declare @num_p varchar(9)
declare cur1 cursor for select do_piece from F_DOCENTETE where (DO_Piece like ('____00')or DO_Piece like ('____A0')or DO_Piece like ('____B0')
or DO_Piece like ('____B0')or DO_Piece like ('____C0') OR DO_Piece like ('____D0')OR DO_Piece like ('____E0')OR DO_Piece like ('____F0')OR DO_Piece like ('____G0')
OR DO_Piece like ('____H0')OR DO_Piece like ('____I0')OR DO_Piece like ('____J0')OR DO_Piece like ('____K0')OR DO_Piece like ('____L0')OR DO_Piece like ('____M0')
OR DO_Piece like ('____N0')OR DO_Piece like ('____O0')OR DO_Piece like ('____P0')OR DO_Piece like ('____Q0')OR DO_Piece like ('____R0')OR DO_Piece like ('____S0')
OR DO_Piece like ('____T0')OR DO_Piece like ('____U0')OR DO_Piece like ('____V0')OR DO_Piece like ('____W0')OR DO_Piece like ('____X0')OR DO_Piece like ('____Y0')
OR DO_Piece like ('____Z0')OR DO_Piece like ('____D0'))and DO_Date between ('01/01/2018') and('31/12/2018') and do_type in ('16','17')
open cur1
fetch cur1 into @num_p
while @@FETCH_STATUS=0
begin
select f_docligne.do_piece,f_docligne.ct_num,F_COMPTET.CT_Intitule,AR_Ref, DL_Design,DL_Qte, DL_PrixUnitaire,DL_PUDevise,DL_Frais,DL_PUTTC, DL_MontantHT,
DL_MontantTTC,DO_Ventile,DO_Cours,f_docligne.do_date from F_DOCLIGNE,F_DOCENTETE,F_COMPTET
WHERE f_docligne.DO_Piece=F_DOCENTETE.DO_Piece and F_DOCLIGNE.DO_Type=F_DOCENTETE.DO_Type and f_docligne.CT_Num=F_DOCENTETE.DO_Tiers
and F_DOCENTETE.DO_Tiers=F_COMPTET.CT_Num and f_docligne.DO_Piece like((select LEFT(@num_p,5))+'_') order by f_docligne.DO_Piece
fetch cur1 into @num_p
end
close cur1
deallocate cur1
the problem is that in sqlserver i see all records while fetching
but in delphi app it returns only last fetch , so how can i get it as SQLSERVER doest , shows data as it is displayed
sql sql-server database delphi ado
sql sql-server database delphi ado
asked Nov 12 at 9:56
user3374161
63111
63111
Please show your Delphi code
– Keith Miller
Nov 12 at 10:00
Can you add some sample table data and the expected result - all as formatted text, not images.
– jarlh
Nov 12 at 10:03
like '___[0,A-Z]0'
– Ivan Starostin
Nov 12 at 10:04
1
I think you could do this in one select statement without using a cursor.
– Keith Miller
Nov 12 at 10:04
but in delphi app
because your code is returning multiple resultsets and client-side code is not ready for this. The simplest workaround: put all records into temp table during cursor processing, perform single select from it in the end. Step 2 - rewrite without cursor, step 3 - normalize your data model.
– Ivan Starostin
Nov 12 at 10:08
|
show 4 more comments
Please show your Delphi code
– Keith Miller
Nov 12 at 10:00
Can you add some sample table data and the expected result - all as formatted text, not images.
– jarlh
Nov 12 at 10:03
like '___[0,A-Z]0'
– Ivan Starostin
Nov 12 at 10:04
1
I think you could do this in one select statement without using a cursor.
– Keith Miller
Nov 12 at 10:04
but in delphi app
because your code is returning multiple resultsets and client-side code is not ready for this. The simplest workaround: put all records into temp table during cursor processing, perform single select from it in the end. Step 2 - rewrite without cursor, step 3 - normalize your data model.
– Ivan Starostin
Nov 12 at 10:08
Please show your Delphi code
– Keith Miller
Nov 12 at 10:00
Please show your Delphi code
– Keith Miller
Nov 12 at 10:00
Can you add some sample table data and the expected result - all as formatted text, not images.
– jarlh
Nov 12 at 10:03
Can you add some sample table data and the expected result - all as formatted text, not images.
– jarlh
Nov 12 at 10:03
like '___[0,A-Z]0'
– Ivan Starostin
Nov 12 at 10:04
like '___[0,A-Z]0'
– Ivan Starostin
Nov 12 at 10:04
1
1
I think you could do this in one select statement without using a cursor.
– Keith Miller
Nov 12 at 10:04
I think you could do this in one select statement without using a cursor.
– Keith Miller
Nov 12 at 10:04
but in delphi app
because your code is returning multiple resultsets and client-side code is not ready for this. The simplest workaround: put all records into temp table during cursor processing, perform single select from it in the end. Step 2 - rewrite without cursor, step 3 - normalize your data model.– Ivan Starostin
Nov 12 at 10:08
but in delphi app
because your code is returning multiple resultsets and client-side code is not ready for this. The simplest workaround: put all records into temp table during cursor processing, perform single select from it in the end. Step 2 - rewrite without cursor, step 3 - normalize your data model.– Ivan Starostin
Nov 12 at 10:08
|
show 4 more comments
2 Answers
2
active
oldest
votes
Your SQL statement returns multiple resultsets, so you need to get each resultset.
I used next approach in old Delphi7 application and it worked for me. All you need is to call NextRecordset() method.
Delphi part:
procedure TForm1.btnOpenClick(Sender: TObject);
var
s: string;
rs: _RecordSet;
n: Integer;
begin
// Here, I assume that you have TADOQuery component already created,
// with correct Connection or ConnectionString property.
s := 'Your SQL statement';
try
if qry.Active then qry.Close;
qry.SQL.Clear;
qry.SQL.Add(s);
qry.Open;
except
on E: Exception do begin
ShowMessage('Error ' + E.Message);
Exit;
end{on};
end{try};
// Consume multiple resultsets
rs := qry.Recordset;
repeat
while not rs.Eof do begin
// Do what you want with fields values.
// ShowMessage(rs.Fields['FieldName'].Value);
rs.MoveNext;
end{while};
rs := qry.NextRecordset(n);
until (rs = nil);
//
qry.Close;
ShowMessage('OK');
end;
SQLServer gets recordsets while fetching , where qry.open waits till the whole request is completed
– user3374161
Nov 12 at 10:53
Imo yourrepeat
loop should be awhile
one, otherwise it's an accoident waiting th happen.
– MartynA
Nov 12 at 10:55
@MartynA Sorry for delay and thanks for this comment. I use 'repeat' loop because of the nature of NextRecordSet() method (first call returns a dataset for the second set of records) and the type of the SQL statements (only SELECT). Of course this can be done with 'while', but it is interesting for me to know what are possible disadvantages of using 'repeat'.
– Zhorov
Nov 12 at 13:40
I guess that Ifrs
would benil
from the start, than therepeat
will still force the codewhile not rs.Eof do
to execute, and becausers
isnil
it will not end well
– GuidoG
Nov 12 at 15:00
@GuidoG Yes, this is obvious (repeat
works that way), but whyrs
would benil
afterqry.Open
? Is here something about ADO multiple resultsets, that I miss? Thanks.
– Zhorov
Nov 12 at 15:18
|
show 1 more comment
This does not answers the question how to get your query as SQL Server does , but you could retrieve your results by rewriting your query so you dont need a cursor.
Its hard to alter a query when little is known about the schema, but I tried anyway.
You should really use the newer join style, it is around for more than 20 years now and is much more readable.
Also use date formats that are region independant, like 'yyyyMMdd' for example.
This should get you started, but you need to fill in a lot of ??? off course
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where (E.DO_Piece like ('____00') or E.DO_Piece like ('____A0') or E.DO_Piece like ('____B0')
or E.DO_Piece like ('____B0') or E.DO_Piece like ('____C0') OR E.DO_Piece like ('____D0') OR E.DO_Piece like ('____E0') OR E.DO_Piece like ('____F0') OR E.DO_Piece like ('____G0')
OR E.DO_Piece like ('____H0') OR E.DO_Piece like ('____I0') OR E.DO_Piece like ('____J0') OR E.DO_Piece like ('____K0') OR E.DO_Piece like ('____L0') OR E.DO_Piece like ('____M0')
OR E.DO_Piece like ('____N0') OR E.DO_Piece like ('____O0') OR E.DO_Piece like ('____P0') OR E.DO_Piece like ('____Q0') OR E.DO_Piece like ('____R0') OR E.DO_Piece like ('____S0')
OR E.DO_Piece like ('____T0') OR E.DO_Piece like ('____U0') OR E.DO_Piece like ('____V0') OR E.DO_Piece like ('____W0') OR E.DO_Piece like ('____X0') OR E.DO_Piece like ('____Y0')
OR E.DO_Piece like ('____Z0') OR E.DO_Piece like ('____D0')
)
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
or as suggested by @IvanStarostin you could do
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where E.DO_Piece like '___[0A-Z]0'
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
How does this explain what the OP was asking, namely why his Delphi app only retreives the last part of what SSMS does?
– MartynA
Nov 12 at 10:42
@MartynA well it does not, it offers another way to retrieve his data that only has one part
– GuidoG
Nov 12 at 10:43
@MartynA And in the comments he did ask how to rewrite without using a cursor
– GuidoG
Nov 12 at 10:46
Sorry, his question should in the q, not in a comment. His q says "so how can i get it as SQLSERVER doest?"
– MartynA
Nov 12 at 10:49
@MartynA I added that in the answer
– GuidoG
Nov 12 at 10:52
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259678%2fhow-to-get-all-data-as-it-is-available-from-sqlserver%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your SQL statement returns multiple resultsets, so you need to get each resultset.
I used next approach in old Delphi7 application and it worked for me. All you need is to call NextRecordset() method.
Delphi part:
procedure TForm1.btnOpenClick(Sender: TObject);
var
s: string;
rs: _RecordSet;
n: Integer;
begin
// Here, I assume that you have TADOQuery component already created,
// with correct Connection or ConnectionString property.
s := 'Your SQL statement';
try
if qry.Active then qry.Close;
qry.SQL.Clear;
qry.SQL.Add(s);
qry.Open;
except
on E: Exception do begin
ShowMessage('Error ' + E.Message);
Exit;
end{on};
end{try};
// Consume multiple resultsets
rs := qry.Recordset;
repeat
while not rs.Eof do begin
// Do what you want with fields values.
// ShowMessage(rs.Fields['FieldName'].Value);
rs.MoveNext;
end{while};
rs := qry.NextRecordset(n);
until (rs = nil);
//
qry.Close;
ShowMessage('OK');
end;
SQLServer gets recordsets while fetching , where qry.open waits till the whole request is completed
– user3374161
Nov 12 at 10:53
Imo yourrepeat
loop should be awhile
one, otherwise it's an accoident waiting th happen.
– MartynA
Nov 12 at 10:55
@MartynA Sorry for delay and thanks for this comment. I use 'repeat' loop because of the nature of NextRecordSet() method (first call returns a dataset for the second set of records) and the type of the SQL statements (only SELECT). Of course this can be done with 'while', but it is interesting for me to know what are possible disadvantages of using 'repeat'.
– Zhorov
Nov 12 at 13:40
I guess that Ifrs
would benil
from the start, than therepeat
will still force the codewhile not rs.Eof do
to execute, and becausers
isnil
it will not end well
– GuidoG
Nov 12 at 15:00
@GuidoG Yes, this is obvious (repeat
works that way), but whyrs
would benil
afterqry.Open
? Is here something about ADO multiple resultsets, that I miss? Thanks.
– Zhorov
Nov 12 at 15:18
|
show 1 more comment
Your SQL statement returns multiple resultsets, so you need to get each resultset.
I used next approach in old Delphi7 application and it worked for me. All you need is to call NextRecordset() method.
Delphi part:
procedure TForm1.btnOpenClick(Sender: TObject);
var
s: string;
rs: _RecordSet;
n: Integer;
begin
// Here, I assume that you have TADOQuery component already created,
// with correct Connection or ConnectionString property.
s := 'Your SQL statement';
try
if qry.Active then qry.Close;
qry.SQL.Clear;
qry.SQL.Add(s);
qry.Open;
except
on E: Exception do begin
ShowMessage('Error ' + E.Message);
Exit;
end{on};
end{try};
// Consume multiple resultsets
rs := qry.Recordset;
repeat
while not rs.Eof do begin
// Do what you want with fields values.
// ShowMessage(rs.Fields['FieldName'].Value);
rs.MoveNext;
end{while};
rs := qry.NextRecordset(n);
until (rs = nil);
//
qry.Close;
ShowMessage('OK');
end;
SQLServer gets recordsets while fetching , where qry.open waits till the whole request is completed
– user3374161
Nov 12 at 10:53
Imo yourrepeat
loop should be awhile
one, otherwise it's an accoident waiting th happen.
– MartynA
Nov 12 at 10:55
@MartynA Sorry for delay and thanks for this comment. I use 'repeat' loop because of the nature of NextRecordSet() method (first call returns a dataset for the second set of records) and the type of the SQL statements (only SELECT). Of course this can be done with 'while', but it is interesting for me to know what are possible disadvantages of using 'repeat'.
– Zhorov
Nov 12 at 13:40
I guess that Ifrs
would benil
from the start, than therepeat
will still force the codewhile not rs.Eof do
to execute, and becausers
isnil
it will not end well
– GuidoG
Nov 12 at 15:00
@GuidoG Yes, this is obvious (repeat
works that way), but whyrs
would benil
afterqry.Open
? Is here something about ADO multiple resultsets, that I miss? Thanks.
– Zhorov
Nov 12 at 15:18
|
show 1 more comment
Your SQL statement returns multiple resultsets, so you need to get each resultset.
I used next approach in old Delphi7 application and it worked for me. All you need is to call NextRecordset() method.
Delphi part:
procedure TForm1.btnOpenClick(Sender: TObject);
var
s: string;
rs: _RecordSet;
n: Integer;
begin
// Here, I assume that you have TADOQuery component already created,
// with correct Connection or ConnectionString property.
s := 'Your SQL statement';
try
if qry.Active then qry.Close;
qry.SQL.Clear;
qry.SQL.Add(s);
qry.Open;
except
on E: Exception do begin
ShowMessage('Error ' + E.Message);
Exit;
end{on};
end{try};
// Consume multiple resultsets
rs := qry.Recordset;
repeat
while not rs.Eof do begin
// Do what you want with fields values.
// ShowMessage(rs.Fields['FieldName'].Value);
rs.MoveNext;
end{while};
rs := qry.NextRecordset(n);
until (rs = nil);
//
qry.Close;
ShowMessage('OK');
end;
Your SQL statement returns multiple resultsets, so you need to get each resultset.
I used next approach in old Delphi7 application and it worked for me. All you need is to call NextRecordset() method.
Delphi part:
procedure TForm1.btnOpenClick(Sender: TObject);
var
s: string;
rs: _RecordSet;
n: Integer;
begin
// Here, I assume that you have TADOQuery component already created,
// with correct Connection or ConnectionString property.
s := 'Your SQL statement';
try
if qry.Active then qry.Close;
qry.SQL.Clear;
qry.SQL.Add(s);
qry.Open;
except
on E: Exception do begin
ShowMessage('Error ' + E.Message);
Exit;
end{on};
end{try};
// Consume multiple resultsets
rs := qry.Recordset;
repeat
while not rs.Eof do begin
// Do what you want with fields values.
// ShowMessage(rs.Fields['FieldName'].Value);
rs.MoveNext;
end{while};
rs := qry.NextRecordset(n);
until (rs = nil);
//
qry.Close;
ShowMessage('OK');
end;
answered Nov 12 at 10:51
Zhorov
3,0142515
3,0142515
SQLServer gets recordsets while fetching , where qry.open waits till the whole request is completed
– user3374161
Nov 12 at 10:53
Imo yourrepeat
loop should be awhile
one, otherwise it's an accoident waiting th happen.
– MartynA
Nov 12 at 10:55
@MartynA Sorry for delay and thanks for this comment. I use 'repeat' loop because of the nature of NextRecordSet() method (first call returns a dataset for the second set of records) and the type of the SQL statements (only SELECT). Of course this can be done with 'while', but it is interesting for me to know what are possible disadvantages of using 'repeat'.
– Zhorov
Nov 12 at 13:40
I guess that Ifrs
would benil
from the start, than therepeat
will still force the codewhile not rs.Eof do
to execute, and becausers
isnil
it will not end well
– GuidoG
Nov 12 at 15:00
@GuidoG Yes, this is obvious (repeat
works that way), but whyrs
would benil
afterqry.Open
? Is here something about ADO multiple resultsets, that I miss? Thanks.
– Zhorov
Nov 12 at 15:18
|
show 1 more comment
SQLServer gets recordsets while fetching , where qry.open waits till the whole request is completed
– user3374161
Nov 12 at 10:53
Imo yourrepeat
loop should be awhile
one, otherwise it's an accoident waiting th happen.
– MartynA
Nov 12 at 10:55
@MartynA Sorry for delay and thanks for this comment. I use 'repeat' loop because of the nature of NextRecordSet() method (first call returns a dataset for the second set of records) and the type of the SQL statements (only SELECT). Of course this can be done with 'while', but it is interesting for me to know what are possible disadvantages of using 'repeat'.
– Zhorov
Nov 12 at 13:40
I guess that Ifrs
would benil
from the start, than therepeat
will still force the codewhile not rs.Eof do
to execute, and becausers
isnil
it will not end well
– GuidoG
Nov 12 at 15:00
@GuidoG Yes, this is obvious (repeat
works that way), but whyrs
would benil
afterqry.Open
? Is here something about ADO multiple resultsets, that I miss? Thanks.
– Zhorov
Nov 12 at 15:18
SQLServer gets recordsets while fetching , where qry.open waits till the whole request is completed
– user3374161
Nov 12 at 10:53
SQLServer gets recordsets while fetching , where qry.open waits till the whole request is completed
– user3374161
Nov 12 at 10:53
Imo your
repeat
loop should be a while
one, otherwise it's an accoident waiting th happen.– MartynA
Nov 12 at 10:55
Imo your
repeat
loop should be a while
one, otherwise it's an accoident waiting th happen.– MartynA
Nov 12 at 10:55
@MartynA Sorry for delay and thanks for this comment. I use 'repeat' loop because of the nature of NextRecordSet() method (first call returns a dataset for the second set of records) and the type of the SQL statements (only SELECT). Of course this can be done with 'while', but it is interesting for me to know what are possible disadvantages of using 'repeat'.
– Zhorov
Nov 12 at 13:40
@MartynA Sorry for delay and thanks for this comment. I use 'repeat' loop because of the nature of NextRecordSet() method (first call returns a dataset for the second set of records) and the type of the SQL statements (only SELECT). Of course this can be done with 'while', but it is interesting for me to know what are possible disadvantages of using 'repeat'.
– Zhorov
Nov 12 at 13:40
I guess that If
rs
would be nil
from the start, than the repeat
will still force the code while not rs.Eof do
to execute, and because rs
is nil
it will not end well– GuidoG
Nov 12 at 15:00
I guess that If
rs
would be nil
from the start, than the repeat
will still force the code while not rs.Eof do
to execute, and because rs
is nil
it will not end well– GuidoG
Nov 12 at 15:00
@GuidoG Yes, this is obvious (
repeat
works that way), but why rs
would be nil
after qry.Open
? Is here something about ADO multiple resultsets, that I miss? Thanks.– Zhorov
Nov 12 at 15:18
@GuidoG Yes, this is obvious (
repeat
works that way), but why rs
would be nil
after qry.Open
? Is here something about ADO multiple resultsets, that I miss? Thanks.– Zhorov
Nov 12 at 15:18
|
show 1 more comment
This does not answers the question how to get your query as SQL Server does , but you could retrieve your results by rewriting your query so you dont need a cursor.
Its hard to alter a query when little is known about the schema, but I tried anyway.
You should really use the newer join style, it is around for more than 20 years now and is much more readable.
Also use date formats that are region independant, like 'yyyyMMdd' for example.
This should get you started, but you need to fill in a lot of ??? off course
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where (E.DO_Piece like ('____00') or E.DO_Piece like ('____A0') or E.DO_Piece like ('____B0')
or E.DO_Piece like ('____B0') or E.DO_Piece like ('____C0') OR E.DO_Piece like ('____D0') OR E.DO_Piece like ('____E0') OR E.DO_Piece like ('____F0') OR E.DO_Piece like ('____G0')
OR E.DO_Piece like ('____H0') OR E.DO_Piece like ('____I0') OR E.DO_Piece like ('____J0') OR E.DO_Piece like ('____K0') OR E.DO_Piece like ('____L0') OR E.DO_Piece like ('____M0')
OR E.DO_Piece like ('____N0') OR E.DO_Piece like ('____O0') OR E.DO_Piece like ('____P0') OR E.DO_Piece like ('____Q0') OR E.DO_Piece like ('____R0') OR E.DO_Piece like ('____S0')
OR E.DO_Piece like ('____T0') OR E.DO_Piece like ('____U0') OR E.DO_Piece like ('____V0') OR E.DO_Piece like ('____W0') OR E.DO_Piece like ('____X0') OR E.DO_Piece like ('____Y0')
OR E.DO_Piece like ('____Z0') OR E.DO_Piece like ('____D0')
)
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
or as suggested by @IvanStarostin you could do
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where E.DO_Piece like '___[0A-Z]0'
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
How does this explain what the OP was asking, namely why his Delphi app only retreives the last part of what SSMS does?
– MartynA
Nov 12 at 10:42
@MartynA well it does not, it offers another way to retrieve his data that only has one part
– GuidoG
Nov 12 at 10:43
@MartynA And in the comments he did ask how to rewrite without using a cursor
– GuidoG
Nov 12 at 10:46
Sorry, his question should in the q, not in a comment. His q says "so how can i get it as SQLSERVER doest?"
– MartynA
Nov 12 at 10:49
@MartynA I added that in the answer
– GuidoG
Nov 12 at 10:52
|
show 1 more comment
This does not answers the question how to get your query as SQL Server does , but you could retrieve your results by rewriting your query so you dont need a cursor.
Its hard to alter a query when little is known about the schema, but I tried anyway.
You should really use the newer join style, it is around for more than 20 years now and is much more readable.
Also use date formats that are region independant, like 'yyyyMMdd' for example.
This should get you started, but you need to fill in a lot of ??? off course
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where (E.DO_Piece like ('____00') or E.DO_Piece like ('____A0') or E.DO_Piece like ('____B0')
or E.DO_Piece like ('____B0') or E.DO_Piece like ('____C0') OR E.DO_Piece like ('____D0') OR E.DO_Piece like ('____E0') OR E.DO_Piece like ('____F0') OR E.DO_Piece like ('____G0')
OR E.DO_Piece like ('____H0') OR E.DO_Piece like ('____I0') OR E.DO_Piece like ('____J0') OR E.DO_Piece like ('____K0') OR E.DO_Piece like ('____L0') OR E.DO_Piece like ('____M0')
OR E.DO_Piece like ('____N0') OR E.DO_Piece like ('____O0') OR E.DO_Piece like ('____P0') OR E.DO_Piece like ('____Q0') OR E.DO_Piece like ('____R0') OR E.DO_Piece like ('____S0')
OR E.DO_Piece like ('____T0') OR E.DO_Piece like ('____U0') OR E.DO_Piece like ('____V0') OR E.DO_Piece like ('____W0') OR E.DO_Piece like ('____X0') OR E.DO_Piece like ('____Y0')
OR E.DO_Piece like ('____Z0') OR E.DO_Piece like ('____D0')
)
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
or as suggested by @IvanStarostin you could do
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where E.DO_Piece like '___[0A-Z]0'
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
How does this explain what the OP was asking, namely why his Delphi app only retreives the last part of what SSMS does?
– MartynA
Nov 12 at 10:42
@MartynA well it does not, it offers another way to retrieve his data that only has one part
– GuidoG
Nov 12 at 10:43
@MartynA And in the comments he did ask how to rewrite without using a cursor
– GuidoG
Nov 12 at 10:46
Sorry, his question should in the q, not in a comment. His q says "so how can i get it as SQLSERVER doest?"
– MartynA
Nov 12 at 10:49
@MartynA I added that in the answer
– GuidoG
Nov 12 at 10:52
|
show 1 more comment
This does not answers the question how to get your query as SQL Server does , but you could retrieve your results by rewriting your query so you dont need a cursor.
Its hard to alter a query when little is known about the schema, but I tried anyway.
You should really use the newer join style, it is around for more than 20 years now and is much more readable.
Also use date formats that are region independant, like 'yyyyMMdd' for example.
This should get you started, but you need to fill in a lot of ??? off course
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where (E.DO_Piece like ('____00') or E.DO_Piece like ('____A0') or E.DO_Piece like ('____B0')
or E.DO_Piece like ('____B0') or E.DO_Piece like ('____C0') OR E.DO_Piece like ('____D0') OR E.DO_Piece like ('____E0') OR E.DO_Piece like ('____F0') OR E.DO_Piece like ('____G0')
OR E.DO_Piece like ('____H0') OR E.DO_Piece like ('____I0') OR E.DO_Piece like ('____J0') OR E.DO_Piece like ('____K0') OR E.DO_Piece like ('____L0') OR E.DO_Piece like ('____M0')
OR E.DO_Piece like ('____N0') OR E.DO_Piece like ('____O0') OR E.DO_Piece like ('____P0') OR E.DO_Piece like ('____Q0') OR E.DO_Piece like ('____R0') OR E.DO_Piece like ('____S0')
OR E.DO_Piece like ('____T0') OR E.DO_Piece like ('____U0') OR E.DO_Piece like ('____V0') OR E.DO_Piece like ('____W0') OR E.DO_Piece like ('____X0') OR E.DO_Piece like ('____Y0')
OR E.DO_Piece like ('____Z0') OR E.DO_Piece like ('____D0')
)
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
or as suggested by @IvanStarostin you could do
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where E.DO_Piece like '___[0A-Z]0'
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
This does not answers the question how to get your query as SQL Server does , but you could retrieve your results by rewriting your query so you dont need a cursor.
Its hard to alter a query when little is known about the schema, but I tried anyway.
You should really use the newer join style, it is around for more than 20 years now and is much more readable.
Also use date formats that are region independant, like 'yyyyMMdd' for example.
This should get you started, but you need to fill in a lot of ??? off course
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where (E.DO_Piece like ('____00') or E.DO_Piece like ('____A0') or E.DO_Piece like ('____B0')
or E.DO_Piece like ('____B0') or E.DO_Piece like ('____C0') OR E.DO_Piece like ('____D0') OR E.DO_Piece like ('____E0') OR E.DO_Piece like ('____F0') OR E.DO_Piece like ('____G0')
OR E.DO_Piece like ('____H0') OR E.DO_Piece like ('____I0') OR E.DO_Piece like ('____J0') OR E.DO_Piece like ('____K0') OR E.DO_Piece like ('____L0') OR E.DO_Piece like ('____M0')
OR E.DO_Piece like ('____N0') OR E.DO_Piece like ('____O0') OR E.DO_Piece like ('____P0') OR E.DO_Piece like ('____Q0') OR E.DO_Piece like ('____R0') OR E.DO_Piece like ('____S0')
OR E.DO_Piece like ('____T0') OR E.DO_Piece like ('____U0') OR E.DO_Piece like ('____V0') OR E.DO_Piece like ('____W0') OR E.DO_Piece like ('____X0') OR E.DO_Piece like ('____Y0')
OR E.DO_Piece like ('____Z0') OR E.DO_Piece like ('____D0')
)
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
or as suggested by @IvanStarostin you could do
select L.do_piece, L.ct_num, E.CT_Intitule, ???.AR_Ref, ???.DL_Design, ???.DL_Qte, ???.DL_PrixUnitaire, ???.DL_PUDevise,
???.DL_Frais, ???.DL_PUTTC, ???DL_MontantHT, ???.DL_MontantTTC, ???.DO_Ventile, ???.DO_Cours, L.do_date
from F_DOCLIGNE L
inner join F_DOCENTETE E on L.DO_Piece = E.DO_Piece
and L.DO_Type = E.DO_Type
and L.CT_Num = E.DO_Tiers
inner join F_COMPTET P on E.DO_Tiers = P.CT_Num
where E.DO_Piece like '___[0A-Z]0'
and E.DO_Date between ('20180101') and('20181231')
and E.do_type in ('16','17')
order by L.DO_Piece
edited Nov 12 at 15:44
answered Nov 12 at 10:39
GuidoG
5,22931743
5,22931743
How does this explain what the OP was asking, namely why his Delphi app only retreives the last part of what SSMS does?
– MartynA
Nov 12 at 10:42
@MartynA well it does not, it offers another way to retrieve his data that only has one part
– GuidoG
Nov 12 at 10:43
@MartynA And in the comments he did ask how to rewrite without using a cursor
– GuidoG
Nov 12 at 10:46
Sorry, his question should in the q, not in a comment. His q says "so how can i get it as SQLSERVER doest?"
– MartynA
Nov 12 at 10:49
@MartynA I added that in the answer
– GuidoG
Nov 12 at 10:52
|
show 1 more comment
How does this explain what the OP was asking, namely why his Delphi app only retreives the last part of what SSMS does?
– MartynA
Nov 12 at 10:42
@MartynA well it does not, it offers another way to retrieve his data that only has one part
– GuidoG
Nov 12 at 10:43
@MartynA And in the comments he did ask how to rewrite without using a cursor
– GuidoG
Nov 12 at 10:46
Sorry, his question should in the q, not in a comment. His q says "so how can i get it as SQLSERVER doest?"
– MartynA
Nov 12 at 10:49
@MartynA I added that in the answer
– GuidoG
Nov 12 at 10:52
How does this explain what the OP was asking, namely why his Delphi app only retreives the last part of what SSMS does?
– MartynA
Nov 12 at 10:42
How does this explain what the OP was asking, namely why his Delphi app only retreives the last part of what SSMS does?
– MartynA
Nov 12 at 10:42
@MartynA well it does not, it offers another way to retrieve his data that only has one part
– GuidoG
Nov 12 at 10:43
@MartynA well it does not, it offers another way to retrieve his data that only has one part
– GuidoG
Nov 12 at 10:43
@MartynA And in the comments he did ask how to rewrite without using a cursor
– GuidoG
Nov 12 at 10:46
@MartynA And in the comments he did ask how to rewrite without using a cursor
– GuidoG
Nov 12 at 10:46
Sorry, his question should in the q, not in a comment. His q says "so how can i get it as SQLSERVER doest?"
– MartynA
Nov 12 at 10:49
Sorry, his question should in the q, not in a comment. His q says "so how can i get it as SQLSERVER doest?"
– MartynA
Nov 12 at 10:49
@MartynA I added that in the answer
– GuidoG
Nov 12 at 10:52
@MartynA I added that in the answer
– GuidoG
Nov 12 at 10:52
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259678%2fhow-to-get-all-data-as-it-is-available-from-sqlserver%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please show your Delphi code
– Keith Miller
Nov 12 at 10:00
Can you add some sample table data and the expected result - all as formatted text, not images.
– jarlh
Nov 12 at 10:03
like '___[0,A-Z]0'
– Ivan Starostin
Nov 12 at 10:04
1
I think you could do this in one select statement without using a cursor.
– Keith Miller
Nov 12 at 10:04
but in delphi app
because your code is returning multiple resultsets and client-side code is not ready for this. The simplest workaround: put all records into temp table during cursor processing, perform single select from it in the end. Step 2 - rewrite without cursor, step 3 - normalize your data model.– Ivan Starostin
Nov 12 at 10:08