[Solved] AMPscript error: Data Extension key field has a MAX or unlimited length

Eliot Harper Asks: AMPscript error: Data Extension key field has a MAX or unlimited length
I’m experiencing a strange error from a LookupRows function. I’ve thought I’ve seen every single AMPscript error, until today. The following AMPscript code:

Code:
set @sendLogRows = LookupRows('SendLog', 'SubID', 39739981, 'TriggeredSendID', '66d03afd-07ef-eb11-b856-b883035be801')

Returns the error:

The Data Extension Key field for a LookupRows function call is invalid. The key field has a MAX or unlimited length. Fields with MAX or unlimited length cannot be used as keys.

I get the same error using this DE if I use a Lookup function (with modified arguments).

Here’s my DE schema:


DE Schema

Nothing unusual here, right?

I’m not sure what the ‘the Data Extension Key field’ actually is. For sake of complete visibility (in case the UI isn’t displaying something correctly), I’ve retrieved the DE field properties using WSProxy. This returns the payload below. Again, all seems as I’d expect. If anyone has an idea of what to try next, I’d be really grateful!

Code:
{
   "Status":"OK",
   "RequestID":"355ef440-7912-49c8-8a96-d11631bc4c6c",
   "Results":[
      {
         "Name":"SubID",
         "FieldType":"Number",
         "IsPrimaryKey":false,
         "MaxLength":0,
         "Ordinal":4,
         "DefaultValue":""
      },
      {
         "Name":"TriggeredSendID",
         "FieldType":"Text",
         "IsPrimaryKey":false,
         "MaxLength":0,
         "Ordinal":5,
         "DefaultValue":""
      },
      {
         "Name":"view_email_url",
         "FieldType":"Text",
         "IsPrimaryKey":false,
         "MaxLength":900,
         "Ordinal":9,
         "DefaultValue":""
      },
      {
         "Name":"CampaignName",
         "FieldType":"Text",
         "IsPrimaryKey":false,
         "MaxLength":254,
         "Ordinal":8,
         "DefaultValue":""
      },
      {
         "Name":"ListID",
         "FieldType":"Number",
         "IsPrimaryKey":false,
         "MaxLength":0,
         "Ordinal":2,
         "DefaultValue":""
      },
      {
         "Name":"BatchID",
         "FieldType":"Number",
         "IsPrimaryKey":false,
         "MaxLength":0,
         "Ordinal":3,
         "DefaultValue":""
      },
      {
         "Name":"CampaignID",
         "FieldType":"Text",
         "IsPrimaryKey":false,
         "MaxLength":50,
         "Ordinal":7,
         "DefaultValue":""
      },
      {
         "Name":"ErrorCode",
         "FieldType":"Number",
         "IsPrimaryKey":false,
         "MaxLength":0,
         "Ordinal":6,
         "DefaultValue":""
      },
      {
         "Name":"JobID",
         "FieldType":"Number",
         "IsPrimaryKey":false,
         "MaxLength":0,
         "Ordinal":1,
         "DefaultValue":""
      }
   ],
   "HasMoreRows":false
}

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.