title: Intersystems Cache String as %Stream.GlobalCharacter
body: <p>I am trying to save (and load) a reasonably long string to a Cache Class String(MAXLEN=1024000) Property.</p>
  
  <p>The string is around 32,000 characters long and instead of storing the string contents (which is a JSON object for what it's worth) it stores</p>
  
  <p><code>2@%Stream.GlobalCharacter</code></p>
  
  <p><a href="https://i.stack.imgur.com/0YGUb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0YGUb.png" alt="How data is saved"></a></p>
  
  <p>When I try to load the string content in my C# program I literally get the string above, I do not get the JSON. When viewing the table via the Cache web and terminal interfaces I see the above string as well.</p>
  
  <p>I have another JSON string which is around 23,000 characters long and that saves and loads without issue.</p>
  
  <p>I understand that <code>2@%Stream.GlobalCharacter</code> is a way of storing data, but I would like to easily be able to load/save it as a string.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I am attempting to save the data in my C# ASP.Net App as follows</p>
  
  <pre><code>sql = "INSERT INTO Namespace.Table ( Name, Active, Revision, Definition ) VALUES ( ?, 1, ?, ? )";
  
  cC = new CacheCommand(sql, dbConn);
  cC.Parameters.Add(new CacheParameter("name", formType)); // string
  cC.Parameters.Add(new CacheParameter("revision", revision)); // int
  cC.Parameters.Add(new CacheParameter("definition", formData)); // string
  
  cC.ExecuteNonQuery();
  </code></pre>
  
  <p>I am loading the data as follows</p>
  
  <pre><code>string sql = "SELECT TOP 1 * FROM Namespace.Table WHERE Active = 1 AND Name = ? ORDER BY Revision DESC";
  CacheCommand cC = new CacheCommand(sql, dbConn);
  cC.Parameters.Add(new CacheParameter("name",formType));
  CacheDataReader rdr = cC.ExecuteReader();
  while(rdr.Read())
  {
      string json = rdr["Definition"].ToString();
  }
  </code></pre>