I am looking to import a simple SQL report directly into excel with VBA, and I am unsure whether to split the code into three separate the VBA sub into three distinct parts due to a combination of creating temporary table/appending parameter and running stored procedure/querying temporary table. I have queried data from the server in the past, but do not want to attempt this one until I get some input.
I have not tried to pass this to the server yet, but here is a mock example of the type of SQL code I would be trying to pass:
`Create #DealTable (
[DealName] varchars(45)
Create #DealTable (
[DealName] varchars(45)
,[DealNumber] varchars(45)
,[Location] varchars (45),
)
Insert into #DealTable execute dbo.DealTrack @IDLog
Select
[#DealTable].[DealName] [DealName]
,[#DealTable].[DealNumber] [DealNumber]
,[#DealTable].[Location] [Location]
From [#DealTable] (NoLock)
'N, @IDLog = 1`
Would I split this up between an ADODB.Recordset and ADODB.Command? Curious to hear how to approach this.