 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tarang Deshpande Guest
|
Posted: Fri Nov 05, 2004 5:44 am Post subject: Pass-Through to MS-SQL |
|
|
I have a very complex query (delete temporary tables if they exists, combine
several complex queries into a temporary tables to yield the final temporary
table). The query works just fine using he SQL Query Analyzer but with
either TQuery or TADOQuery I get errors. I was reading around the web and
saw several references to a "pass-through" where the SQL query text can be
sent directly to the SQL Server. However I didn't see anything about how to
actually do a pass-through.
How do I do a pass-through or is there some other way for me to execute the
query and get the resultant set of records?
Tarang
|
|
| Back to top |
|
 |
Viatcheslav V. Vassiliev Guest
|
Posted: Fri Nov 05, 2004 9:12 am Post subject: Re: Pass-Through to MS-SQL |
|
|
If your query contains GO, you should separate it on some queries and
execute one after other, Query Analyzer does this internally.
In QA, select ToolsOptions in menu, then Connection Properties tab. Thise
properties QA sets for connection that is used to execute query (it is not
ADO, but it works the same way). Try to add these properties into your
script, such as SET ANSI_NULLS ON.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Tarang Deshpande" <tarang (AT) inferant (DOT) com> сообщил/сообщила в новостях
следующее: news:418b1348$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I have a very complex query (delete temporary tables if they exists,
combine
several complex queries into a temporary tables to yield the final
temporary
table). The query works just fine using he SQL Query Analyzer but with
either TQuery or TADOQuery I get errors. I was reading around the web and
saw several references to a "pass-through" where the SQL query text can be
sent directly to the SQL Server. However I didn't see anything about how
to
actually do a pass-through.
How do I do a pass-through or is there some other way for me to execute
the
query and get the resultant set of records?
Tarang
|
|
|
| Back to top |
|
 |
Tarang Deshpande Guest
|
Posted: Fri Nov 05, 2004 5:47 pm Post subject: Re: Pass-Through to MS-SQL |
|
|
That seems to work but I could not use my code that deleted temporary tables
if they existed - and it even works if I repeat the query. I'm pretty sure
I'm not doing it the "standard approved" method. Maybe you could suggest
the "standard approved" method of doing it. Here is what I use now.
IF EXISTS ( SELECT [name] FROM [tempdb].[dbo].sysobjects WHERE [name] LIKE
'#TempTable%' )
DROP TABLE #TempTable
Thanks,
Tarang
"Viatcheslav V. Vassiliev" <support (AT) oledbdirect (DOT) com> wrote
| Quote: | If your query contains GO, you should separate it on some queries and
execute one after other, Query Analyzer does this internally.
In QA, select ToolsOptions in menu, then Connection Properties tab. Thise
properties QA sets for connection that is used to execute query (it is not
ADO, but it works the same way). Try to add these properties into your
script, such as SET ANSI_NULLS ON.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Tarang Deshpande" <tarang (AT) inferant (DOT) com> сообщил/сообщила в новостях
следующее: news:418b1348$1 (AT) newsgroups (DOT) borland.com...
I have a very complex query (delete temporary tables if they exists,
combine
several complex queries into a temporary tables to yield the final
temporary
table). The query works just fine using he SQL Query Analyzer but with
either TQuery or TADOQuery I get errors. I was reading around the web
and
saw several references to a "pass-through" where the SQL query text can
be
sent directly to the SQL Server. However I didn't see anything about
how
to
actually do a pass-through.
How do I do a pass-through or is there some other way for me to execute
the
query and get the resultant set of records?
Tarang
|
|
|
| Back to top |
|
 |
Viatcheslav V. Vassiliev Guest
|
Posted: Sat Nov 06, 2004 7:10 am Post subject: Re: Pass-Through to MS-SQL |
|
|
LIKE will return #TempTable1, #TempTableABC etc., but you drop #TempTable
that may exist or not. [name] = '#TempTable' seems to be more appropriate
here.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Tarang Deshpande" <tarang (AT) inferant (DOT) com> сообщил/сообщила в новостях
следующее: news:418bbc9d$2 (AT) newsgroups (DOT) borland.com...
| Quote: | That seems to work but I could not use my code that deleted temporary
tables
if they existed - and it even works if I repeat the query. I'm pretty
sure
I'm not doing it the "standard approved" method. Maybe you could suggest
the "standard approved" method of doing it. Here is what I use now.
IF EXISTS ( SELECT [name] FROM [tempdb].[dbo].sysobjects WHERE [name] LIKE
'#TempTable%' )
DROP TABLE #TempTable
Thanks,
Tarang
"Viatcheslav V. Vassiliev" <support (AT) oledbdirect (DOT) com> wrote in message
news:418b4413$1 (AT) newsgroups (DOT) borland.com...
If your query contains GO, you should separate it on some queries and
execute one after other, Query Analyzer does this internally.
In QA, select ToolsOptions in menu, then Connection Properties tab.
Thise
properties QA sets for connection that is used to execute query (it is
not
ADO, but it works the same way). Try to add these properties into your
script, such as SET ANSI_NULLS ON.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Tarang Deshpande" <tarang (AT) inferant (DOT) com> сообщил/сообщила в новостях
следующее: news:418b1348$1 (AT) newsgroups (DOT) borland.com...
I have a very complex query (delete temporary tables if they exists,
combine
several complex queries into a temporary tables to yield the final
temporary
table). The query works just fine using he SQL Query Analyzer but
with
either TQuery or TADOQuery I get errors. I was reading around the web
and
saw several references to a "pass-through" where the SQL query text
can
be
sent directly to the SQL Server. However I didn't see anything about
how
to
actually do a pass-through.
How do I do a pass-through or is there some other way for me to
execute
the
query and get the resultant set of records?
Tarang
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|