[英]Pervasive SQL query
Does anyone have a query to search all columns in all tables in a Pervasive database for a specific value? 是否有人查询用于在Pervasive数据库的所有表中的所有列中搜索特定值?
I am struggling to find any info on this. 我正在努力寻找有关此的任何信息。
Seems easy to do in sql server but not with Pervasive. 在sql server中似乎很容易做到,但是在Pervasive中却不是。
You don't need a stored procedure. 您不需要存储过程。 You can do it with this query:
您可以使用以下查询进行操作:
select x$file.xf$name, X$Field.* from X$Field, X$File
where xe$File = xf$id and
xe$DataType < 200
and xe$name = '<Column Name>'
order by xe$offset
Changing to the name of the column you are looking for. 更改为您要查找的列的名称。
For example, to find a column named "Name", you would use the statement: 例如,要查找名为“名称”的列,可以使用以下语句:
select x$file.xf$name, X$Field.* from X$Field, X$File
where xe$File = xf$id and
xe$DataType < 200
and xe$name = 'Name'
order by xe$offset
and the results are: 结果是:
Xf$Name Xe$Id Xe$File Xe$Name Xe$DataType Xe$Offset Xe$Size Xe$Dec Xe$Flags
==================== ====== ======= ==================== =========== ========= ======= ====== ========
Course 86 13 Name 0 0 7 0 1
Dept 92 14 Name 0 0 20 0 1
Class 68 12 Name 0 4 7 0 1
--returns a list of all tables sorted by table name: Select * from X$File order by xf$name -返回按表名排序的所有表的列表:从X $ File中按xf $ name选择*
--returns a list of all columns (in order) and their attributes for a table called "Person": select X$Field.* from X$Field, X$File where xe$File = xf$id and xf$name = 'Person' and xe$DataType < 200 order by xe$offset -返回一个名为“ Person”的表的所有列的列表(按顺序)及其属性:从X $ Field,X $ File中选择X $ Field。*,其中xe $ File = xf $ id和xf $ name = 'Person'和xe $ DataType <200由xe $ offset排序
You could use some sort of stored procedure to run through them all. 您可以使用某种存储过程来全部运行它们。 This is a SQL server stored proc that you might be able to use as a guide.
这是一个SQL Server存储的proc,您可能可以将其用作指南。
http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.