Blog Posts

Nick Holdren = Director of Product and Technology - Fanmail Marketing

Clearing A Data Extension Using PHP

2 comments

The following is a short code sample of how to clear a data extension inside of ExactTarget. This is very useful for external applications that need to clear data extensions without the need executing a query or deleting every row one at a time.   It should be noted that this only applies to Enterprise 2.0 accounts and will not work elsewhere. 

<?php
$wsdl 
'https://webservice.exacttarget.com/etframework.wsdl';

/* Create the Soap Client */
$client = new ExactTargetSoapClient($wsdl, array('trace'=>1));

/* Set username and password here */
$client->username 'username';
$client->password 'password';

$de = new ExactTarget_DataExtension();
$de->CustomerKey "DataExtensionExternalKey";

$object = new SoapVar($deSOAP_ENC_OBJECT'DataExtension'"http://exacttarget.com/wsdl/partnerAPI");

$request = new ExactTarget_PerformRequestMsg();
$request->Action "cleardata";
$request->Definitions = array($object);

$results $client->Perform($request);

print_r($results);
?>

NickHoldren's picture
NickHoldren
Wed, 02/15/2012 - 17:09

Van,

The answer sadly is no. This is only a feature available in the Enterprise 2.0 accounts. Like you said the only way to do so outside of E 2.0 is to delete and recreate or execute a query to return an empty result set into a data extension.

Thanks,

Nick

van's picture
van
Wed, 02/15/2012 - 02:50

Nice, is there a way to do this without Enterprise 2.0? Besides deleting and re-creating.

 
397
Questions
 

Recent Blog Comments

 
 

Who's online

There are currently 0 users and 13 guests online.