What are the limitations of the CLR contextual connection?

I am trying to convert existing C # code to a CLR stored procedure. The obvious connection string to use is the context connection ("context connection = true").

The problem I am facing is that some things do not seem to work on this type of connection. The last thing is the SqlConnection.GetSchema method. The error simply says that it is not available in the contextual connection. Is there a list of things that won't work in a contextual join?

+4
source share
3 answers

You may have already seen this on MSDN SQL Server 2008 Books Online , however the following link explains the restrictions that are imposed when using Contextual Connections:

Regular and contextual restrictions

If you publish a full trace of the exception and the stack, then it may be possible to establish from .NET .NET collections (using .NET Reflector) or those deployed with SQL 2005/2008 why this exception is selected.

+4
source

Someone might find this helpful:

System.Data.DataTable schema = null; using (System.Data.SqlClient.SqlCommand cmd = database.Connection.CreateCommand()) { cmd.CommandText = string.Format( "SELECT TOP 1 * FROM {0}", mainTable ); cmd.CommandType = System.Data.CommandType.Text; using (System.Data.SqlClient.SqlDataReader rdr = cmd.ExecuteReader()) { schema = rdr.GetSchemaTable(); } } 
+2
source

After some additional searching, I found this list of things that won't work with contextual connection here . Some of them are also described in the SQL Books link above, but they do not mention all of them.

Things that do not work with contextual connection.

  • ChangePassword Method
  • GetSchema Method
  • Connection pool and related parameters and methods
  • Transparent transition to another resource when using database mirroring
  • PacketSize client statistics, WorkstationID and other client information
+1
source

All Articles