Follow me on Twitter at Twitter.com/wbm
FYI, I'm blogging most of my stuff over at More Wally now.
You might want to add my rss feed to your reader at:http://morewally.com/cs/blogs/wallym/rss.aspx
Get a performance pop within a Sql CLR Stored Procedure - Wallace B. McClure

Wallace B. McClure

All About Wally McClure - The musings of Wallym on Web, HTML5, Mobile, Xamarin.iOS, Xamarin.Android, and Windows Azure.

News

Visual Studio Magazine Column Personal Blog

.NET

Book Authors

Business

Family

Friends

Georgia Tech Bloggers

Personal

Archives

Get a performance pop within a Sql CLR Stored Procedure

According to the BOL with the October CTP bits, you can get a performance improvement with Sql Server 2005 CLR objects if the send the results directly to the network buffer and bypass managed memory.  How do you do this?

Do this:

SqlCommand sqlCm = SqlContext.GetCommand();
sqlCm.CommandText = "blah, blah, blah.........";
SqlContext.GetPipe().Execute(sqlCm);

instead of

SqlCommand sqlCm = SqlContext.GetCommand();
sqlCm.CommandText = "blah, blah, blah..........";
SqlDataReader sqlDr = sqlCm.ExecuteReader();
SqlContext.GetPipe().Send(sqlCm);

Source: ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/denet9/html/bbdd51b2-a9b4-4916-ba6f-7957ac6c3f33.htm

**Note, no code has been checked against the editor to see if it runs, this is just something I pulled from the BOL.  Your mileage may vary**

Comments

Vikram Lashkari said:

Hi,
What if i am using SQL Server 2000 ,will it make any change of not.

Plz do let me know

Thanx a lot my mail.vikram_lashkari@yahoo.com
# December 2, 2004 5:28 AM