cannot use sql temporary tables in VBA (cannot drop table) -
cannot use sql temporary tables in VBA (cannot drop table) -
how can alter vba code manage run temporary table in sql query vba code (stored procedure contains temp table)
sub a() dim connection adodb.connection dim recordset adodb.recordset dim command adodb.command dim strprocname string 'stored procedure name dim strconn string ' connection string. dim selectedval string set connection = new adodb.connection set recordset = new adodb.recordset set command = new adodb.command strconn = "provider=sqloledb.1;persist security info=true;data source =1.1.2.7\b;user id = sa; password=a;initial catalog=a" connection.connectionstring = strconn connection.open command.activeconnection = connection command.commandtext = "ploan_list" command.commandtype = adcmdstoredproc command.parameters.refresh 'command.parameters(1).value = "3" set recordset = command.execute() thisworkbook.sheets("sheet1").cells(1, 1).copyfromrecordset recordset recordset.close set recordset = nil connection.close set connection = nil end sub
really, it's not vba code generates or uses temporary table - it's stored procedure. likewise, it's stored procedure returns temporary table.
for instance, if want homecoming value sets stored procedure you'd select lastly output...
class="lang-sql prettyprint-override">select myfield1, myfield2, myfield_n @mydefinedtable status = requirement
so, perhaps need identify, first, stored procedure does.
perhaps ben nadel can detail improve can.
sql vba
Comments
Post a Comment