Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|