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") 

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

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .