// C# cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Test.spDelimitedString"; cmd.Parameters.AddWithValue("@Values", @"…|…|… …|…|… …|…|…"); cmd.Execute…; -- T-SQL: What happens on the server? EXEC Test.spDelimitedString @Values = '…|…|… …|…|… …|…|…';
Download ReportTranscript // C# cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Test.spDelimitedString"; cmd.Parameters.AddWithValue("@Values", @"…|…|… …|…|… …|…|…"); cmd.Execute…; -- T-SQL: What happens on the server? EXEC Test.spDelimitedString @Values = '…|…|… …|…|… …|…|…';
// C# cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Test.spDelimitedString"; cmd.Parameters.AddWithValue("@Values", @"…|…|… …|…|… …|…|…"); cmd.Execute…; -- T-SQL: What happens on the server?
EXEC Test.spDelimitedString @Values = '…|…|… …|…|… …|…|…';
// C#
cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Test.spXML"; cmd.Parameters.AddWithValue("@Values", xmlDoc.OuterXml); cmd.Execute…; -- T-SQL: What happens on the server?
// C# cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Test.spTVP"; var p = cmd.Parameters.Add("@Values“, SqlDbType.Structured); p.TypeName = "Test.OrderTableType"; p.Value = dataTable; cmd.Execute…; -- T-SQL: What happens on the server?
DECLARE @Values Test.OrderTableType; INSERT @Values … EXEC Test.spTVP @Values = @Values;
// C#
class MyStreamingTvp : IEnumerable
Data passed as delimited string Data passed as XML 266 Data passed as TVP 19 Execution time (ms., lower is better) 32
2.
Querying
the data
Data passed as delimited string Data passed as XML 969 Data passed as TVP 307 Execution time (ms., lower is better) 33
www.microsoft.com/teched http://microsoft.com/technet www.microsoft.com/learning http://microsoft.com/msdn
Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31
st
http://northamerica.msteched.com/registration
You can also register at the North America 2011 kiosk located at registration