I'm trying to use AMPscript to pull the number of rows (all rows, rather than matching to a specific variable) in a data extension and insert that variable into an email. However, the variable I'm using isn't being recognized. Why is that? How can I fix it?

var @rowCount 
set @rowCount = DataExtensionRowCount("DE_Name") 

  • Do you receive an error? Is it located in the same business unit, shared or local? – AnonWonderer Jan 8 at 22:34
  • If it is a shared DE, you will need to use the ent. prefix. E.g. ent.DE_Name. – Gortonington Jan 9 at 14:02

Not an ideal way but you can add a field to your DE and set its default value as "1" to use LookupRows like:


Then you can count all rows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.