You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Compute the expected total bytes independently of the C# APIs under test in order to compare.
973
+
//The inner SELECT generates the XML, CAST converts it to a Unicode string, LEN() * 2 matches s.Length * 2 in C# since UTF-16 uses 2 bytes per character.
974
+
// SUM() totals across all rows, matching the loop below.
975
+
using(SqlCommandcmdExpected=newSqlCommand("SELECT SUM(LEN(CAST(xml_data AS NVARCHAR(MAX))) * 2) FROM "+
976
+
"(SELECT CAST((SELECT * FROM orders FOR XML AUTO) AS NVARCHAR(MAX)) AS xml_data) t",conn))
977
+
{
978
+
expectedTotal=(long)cmdExpected.ExecuteScalar();
979
+
}
980
+
971
981
using(SqlCommandcmd=newSqlCommand("select * from orders for xml auto",conn))
0 commit comments