Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JC. JC. is offline
external usenet poster
 
Posts: 1
Default ADO-SQL-Excel

How can I execute this instruction TRANSACT-SQL with ADO in Excel and then
export it to excel. It is like a record but made with TRANSACT-SQL.
Is it posible???

Select Sum(contdiar.importe*contdiam.tasa * Case When contdiar.debito= 1
Then 1 Else -1 End )
From ContDiam Inner Join ContDiar on ContDiam.Id_Diam = ContDiar.Id_Diam
Where ...

JC.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default ADO-SQL-Excel

What you call 'instruction' is your SQL statement. Try:

set adors = createobject("ADODB.Recordset")
adors.Open 'your SQL statement' , 'the connnection string to SQL server DB'

Now lok up CopyFromREcordSet in the Excel help files to transfer adors to a
worksheet; your SQL statement must return less than 65536 rows and less than
256 columns.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default ADO-SQL-Excel

JC. wrote:
How can I execute this instruction TRANSACT-SQL with ADO in Excel and then
export it to excel. It is like a record but made with TRANSACT-SQL.
Is it posible???

Select Sum(contdiar.importe*contdiam.tasa * Case When contdiar.debito= 1
Then 1 Else -1 End )
From ContDiam Inner Join ContDiar on ContDiam.Id_Diam = ContDiar.Id_Diam
Where ...

JC.


I post a link to Microsoft site a few weeks ago, how to do this.
Try to find it.
ADO is not a T-SQL, but most of things can be done.
There is a bug in ADO which doesn't not allow to work on open files.
So if you want to read on write to the same file as your code it will
not work.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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



All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"