Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Change database context in existing connection?

2 views
Skip to first unread message

chris

unread,
Jul 28, 2009, 2:19:01 AM7/28/09
to
Hello,
I am using the SQL Server Native client Provider in a native C development
and want to change the current database context of an established connection.
Is that possible (If yes -- How?) or I am forced to reconnect with another
database in the connection string?

Thank you for help,
Regards chris

Lucas Kartawidjaja

unread,
Aug 11, 2009, 11:16:01 AM8/11/09
to
Hi Chris

Not sure if this is what you are looking for. Actually once you have
established the connection, you can change hit other databases within the
same server using the query (provided that the user that you are using has
the appropriate permission). For select statment you can: select * from
[database_name].dbo.[table_name]. If you want to execute a stored procedure
that is on a different database exec
[database_name].dbo.[stored_procedure_name]. So you are not really bound to
the initial connection that you've made. Unless off-course the user that you
are using to connect to the database only permits you to that particular
database.

Hope that's helpful.

Thank you
Lucas

0 new messages