Determines whether a command batch has changed the current database to another database.
SqlChange$ ( sqlconn% )
where
The name of the new database, if any. If the database has not changed, an empty string is returned.
SqlChange$ informs the application of a switch from one database to another by catching any instance of the Transact-SQL USE statement.
When connected to SQL Server 4.2, a USE statement does not take effect until the end of the batch. The SqlChange$ function is therefore useful only in determining whether the current command batch has changed to another database for subsequent command batches. The simplest way to keep track of database switches is to call SqlChange$ when SqlResults% returns NOMORERESULTS at the end of each command batch.
When connected to SQL Server 6.0, a USE statement takes effect immediately.
You can also get the name of the current database by calling SqlName$.
SqlExec%, SqlName$, SqlResults%, SqlSend%, SqlUse%