Following this question, I need to add something like
SET LANGUAGE German;
before my SELECT<
This is a misconception. Neither ASP/VBScript limits you, the limit is imposed by the provider ADODB uses to perform the command. In terms of SQL Server though there is no limit (I know of) when executing a command that contains multiple queries.
First
SET LANGUAGE German;
isn't really a returning query but the Provider will return it as a closed ADODB.Recordset
object, which isn't ideal but there is a simple fix.
SET NOCOUNT ON;
Will inhibit DONE_IN_PROC
messages from being sent to say the executing line was successful which is interpreted by ADODB as a closed ADODB.Recordset
object.
Another way to deal with this but not as straight-forward as SET NOCOUNT ON is to use the NextRecordSet() method of the ADODB.Recordset
object to step through the various resultsets until you find the actual query result.
Assuming rs
is our starting ADODB.Recordset
object
Do While (rs.State = adStateClosed And Not rs Is Nothing)
Set rs = rs.NextRecordset
Loop
will return the first ADODB.Recordset
object that isn't in the closed state.
From MSDN - NextRecordset Method (ADO)
As long as there are additional results and the Recordset containing the compound statements is not disconnected or marshaled across process boundaries, the NextRecordset method will continue to return Recordset objects. If a row-returning command executes successfully but returns no records, the returned Recordset object will be open but empty. Test for this case by verifying that the BOF and EOF properties are both True. If a non–row-returning command executes successfully, the returned Recordset object will be closed, which you can verify by testing the State property on the Recordset. When there are no more results, recordset will be set to Nothing.