Tuesday, July 29, 2008

How do you output the results of DQL to a text file?

There is no way to output the results of a DQL to a file from DQL. In other words, you cannot be using DQL on Documentum Administrator or using an external application. The only option available is to run from command line and redirect the output to a file.

WORKAROUND:
Please note that we will not be able to alter the format for the results. This will only return the results from the query to a file. If you want to change the order of the results you need to alter the query itself. Examples below are for Windows based system, do not use "c:\" for your Unix path.

Use the absolute path to file, also the command in Unix is idql, not idql32.
Create a file with DQL query you want to run.
Example:
Created a file called bobdql with the following:
select r_object_id,user_name from dm_user;
go
Then will run the idql command from a command prompt:
idql32 -Uuser -Ppassword -Rinputfile > outputfile
Example
idql32 bob51sql2k -Uuser -Pdmadmin -Rbobdql > c:\dqltest.txt
Results in dqltest.txt:
Documentum idql - Interactive document query interface
(c) Copyright Documentum, Inc., 1992 - 2002
All rights reserved.
Client Library Release 5.1b.0.12 Win32
Connecting to Server using docbase bob51sql2k
Connected to Documentum Server running Release 5.1b.0.12 Win32.SQLServer
1> 2> r_object_id user_name
---------------- --------------------------------
1120b60580000100 docu
1120b60580000101 bob51sql2k
1120b60580000102 dmadmin
1120b60580000107 admingroup
1120b6058000013d bobp
(5 rows affected)
1>
As a note you can output from API, directions are documented in Server Fundamentals Guide.

No comments: