Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用C#CLR对数组中的数据进行排序_C#_Sql Server_Clr - Fatal编程技术网

使用C#CLR对数组中的数据进行排序

使用C#CLR对数组中的数据进行排序,c#,sql-server,clr,C#,Sql Server,Clr,我遵循一个教程,成功地创建了一个VisualStudio项目,该项目将一个C#CLR存储过程附加到我的SQL Server数据库 我希望根据字段值对表中的行进行配对所需的时间进行基准测试。结果看起来像一个二级树 我希望,如果我在内存中执行此操作,然后将结果写回SQL Server,我将通过减少IO来加快进程 目前,我的CLR过程从数据库中获取一个值表,并将它们返回给客户机(SSMS) 我想将所有行移动到数组中。目前还不清楚您打算做什么-可能添加一些示例数据,结果会是什么样子?目前,听起来你想用数

我遵循一个教程,成功地创建了一个VisualStudio项目,该项目将一个C#CLR存储过程附加到我的SQL Server数据库

我希望根据字段值对表中的行进行配对所需的时间进行基准测试。结果看起来像一个二级树

我希望,如果我在内存中执行此操作,然后将结果写回SQL Server,我将通过减少IO来加快进程

目前,我的CLR过程从数据库中获取一个值表,并将它们返回给客户机(SSMS)


我想将所有行移动到数组中。

目前还不清楚您打算做什么-可能添加一些示例数据,结果会是什么样子?目前,听起来你想用数据集做一些事情,并加入这些数据集——关系数据库非常擅长的事情。@Damien_不相信有11个字段,我正在比较x行和x+n行中的字段组合。当我找到匹配项时,我用行id x更新行x+n。这需要约30分钟,因为它发生在一个具有复杂逻辑和update语句的循环中。我的希望是,如果我在C(或C)中做内存(数组)的工作,或者C++,我可以加快工作速度。
public static void SqlStoredProcedure1 ()
{
    int[] Column1 = new int[75000];
    string[] Column2 = new string[75000];
    string[] Column3 = new string[75000];
    string[] Column4 = new string[75000];
    string[] Column5 = new string[75000];
    string[] Column6 = new string[75000];
    string[] Column7 = new string[75000];
    string[] Column8 = new string[75000];
    string[] Column9 = new string[75000];
    string[] Column10 = new string[75000];
    string[] Column11 = new string[75000];

    SqlConnection conn = new SqlConnection();
    conn.ConnectionString = "Context Connection=true";
    SqlCommand cmd = new SqlCommand();
    cmd.Connection = conn;
    cmd.CommandText = @"SQL QUERY - I REPLACED IT FOR PRIVACY";
    conn.Open();
    SqlDataReader rdr = cmd.ExecuteReader();
    SqlContext.Pipe.Send(rdr);
    rdr.Close();
    conn.Close();
}