---
title: "如何在informix中根据表反查出它的SQL语句"
author: "areshowl"
date: "2010-08-14T15:21:21Z"
tags: []
categories: ["数据库"]
slug: "informix-sql"
draft: false
lastmod: "2010-08-14T15:21:21Z"
id: 737354
url: "https://areshowl.iteye.com/blog/737354"
---

如何在informix中根据表反查出它的SQL语句？
                                

用informix 提供的工具 dbschema.
语法：
dbschema     
              -d dbname  

例如，想知道数据库scptest中的chargeclass表的SQL定义语句可以
dbschema -t chargeclass -d scptest 

输出如下：
*************
$>dbschema -t chargeclass -d scptest

DBSCHEMA Schema Utility       INFORMIX-SQL Version 7.31.UC2
Copyright (C) Informix Software, Inc., 1984-1998
Software Serial Number AAC#J654884
{ TABLE "scptest".chargeclass row size = 6 number of columns = 3 index size = 9 }
create table "scptest".chargeclass
  (
    chargeclass smallint not null ,
    feeclass smallint not null ,
    currencyclass smallint not null ,
    primary key (chargeclass)
  );
revoke all on "scpest".chargeclass from "public";
***************

如果查询存储过程，用 -f procname
结果输出到某一文件  dbschema -t chargeclass -d scptest -ss output.sql