Recently i was asked how to create a empty DDF file when you only have an MDD file. In this article we will show you two ways to do this and create any type of empty data file.
First off we will use DMQuery and a stored procedure called xp_syncdb to create a empty file. So with Windows Explorer, go to the folder in which the Visual Basic .NET version of DM Query was installed. By default, this is [INSTALL_FOLDER]IBM\SPSS\DataCollection\7\DDL\Code\Tools\VB.NET\DM Query Query. Double-click the DM Query.exe file.
This opens the DM Query window and the Connection tab in the Data Link Properties dialog box.
On the Connection tab in the Data Link Properties dialog box, select Data Collection Metadata Document from the Metadata Type drop-down list and enter the name and location of the .mdd file in the Metadata Location text box. Select Open metadata Read/Write and then select the Case Data Type drop-down and the data type you want to create. Next enter the name and location of the new file in the Case Data Location text box.
Click OK.
Type EXEC xp_syncdb into the SQL text box and press Enter.
Close DM Query.
Once you have closed DMQuery you should notice that there is a DDF file in the same folder as the mdd file. If you dont want to use dmquery you can use an mrs or dms with the following code.
Dim sConnection, sQuery, oConnection, oRecordset sConnection = "Provider=mrOleDB.Provider.2;Data Source=mrDataFileDsc;Location=BlankDDF.ddf;Initial Catalog=BlankDDF.mdd;MR Init MDM Access=1" Set oConnection = CreateObject("ADODB.Connection") oConnection.Open (sConnection) sQuery = "EXEC xp_syncdb" Set oRecordset = oConnection.Execute(sQuery) Set oRecordset = Null Set oConnection = Null
As you can see we make the connection string for the DDF file , connect to the MDD with an ADO Connection and then run the EXEC xp_syncdb to make the data file.