以下のように、(SQL Server 2008 の) ストアド プロシージャから静的文字列を返しています。
select 'abcdefgh.........xyz'
静的文字列の長さが制限 (例: 8kb) を超えている場合、部分的な文字列 (例: 7kb) のみが .net アプリに返されます。
静的文字列を割り当てvarchar(max)
て変数を選択するなど、さまざまな方法で試しましたが、まだ部分的な文字列しか返されていません。
最大 5 MB の完全な文字列を返す必要があります。したがって、主な懸念事項:
- ストアド プロシージャから返すことができる文字列の最大長はどれくらいですか
- ストアド プロシージャから .net アプリに 5 MB の文字列を返す方法。
誰かがこの問題を解決するのを手伝ってくれるようお願いします。以下のコードを見つけてください
using (SqlCommand command = new SqlCommand(Source.GetExportRecordSP, Connection))
{
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@CandidateRecordID ", SqlDbType.NVarChar, 32)).Value = record;
try
{
if (Connection.State != ConnectionState.Open)
{
Connection.Open();
}
using (SqlDataReader reader = command.ExecuteReader())
{
if(reader.Read())
{
xmlRecord = new XmlDocument();
xmlRecord.LoadXml(reader.GetString(0));
}
}
}
catch (Exception Ex)
{
Logging.WriteError(string.Format("Error while retrieving the Record \"{0}\" details from Database. Exception: {1} ", Ex.ToString()));
throw;
}
}
よろしくお願いします。