system-tables

How to extract Stored Procedure body in Teradata

南笙酒味 提交于 2020-02-03 08:25:43
问题 I'm trying to extract Stored procedure DDL by querying system tables. If I run the following query select * from dbc.tvm where TableKind = 'P' both fields RequestText and CreateText contain NULL. Is there any way to query Stored Procedure body apart from using SHOW PROCEDURE? Thank you. 回答1: The DDL (SPL) for the Stored Procedures is not stored in the data dictionary tables. If you do not retain your DDL in a repository for version control you will need to script the SHOW PROCEDURE commands

How to extract Stored Procedure body in Teradata

感情迁移 提交于 2020-02-03 08:25:25
问题 I'm trying to extract Stored procedure DDL by querying system tables. If I run the following query select * from dbc.tvm where TableKind = 'P' both fields RequestText and CreateText contain NULL. Is there any way to query Stored Procedure body apart from using SHOW PROCEDURE? Thank you. 回答1: The DDL (SPL) for the Stored Procedures is not stored in the data dictionary tables. If you do not retain your DDL in a repository for version control you will need to script the SHOW PROCEDURE commands

mysql: Cant we create triggers on system tables?

被刻印的时光 ゝ 提交于 2019-12-17 17:22:44
问题 I am trying to audit the privilege changes in mysql.user table by writing a trigger on it. insert trigger: will capture who gave the new permissions and when update trigger: will capture who changes the privileges from what[old privilege] remove trigger: will capture who removed the privileges and what are they Now, I am getting an error while writing like ERROR 1465 (HY000): Triggers can not be created on system tables Can we create a trigger on system tables, Is there any work around or it

SQL Server meta data table and column descrption [duplicate]

走远了吗. 提交于 2019-12-11 11:55:19
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: SQL Server: Extract Table Meta-Data (description, fields and their data types) I just like to ask if there is a way to programmatically retrieve table and column descriptions from SQL Server 2008? These are the descriptions that you can enter when using the UI. And if so, is there a way to programmatically update them as well? Thanks. 回答1: If you want to retrieve the "descriptions" you set using MSSMS's UI you

Which permission need to grant to access sys.dba_systems

落爺英雄遲暮 提交于 2019-12-11 05:58:36
问题 I am working on the application which works on Oracle. For some kind of logic I need to get the list of tables from the given db user with the specified schema. In my case, I have a user which have granted access of the given schema. So when my code creates connection using the given credential and tries to fetch the tables from the following query, its return table list. SELECT * FROM dba_objects where owner ='schema' and object_type = 'TABLE' The above query was working with user having

How to get proper column types in Sybase

烂漫一生 提交于 2019-12-11 04:36:32
问题 I have to know the data type of some columns in my table in Sybase ASE. Here is my query select name from systypes where type in (39, 47, 39, 39, 106 ) this returns char varchar sysname nchar nvarchar decimaln longsysname I was hoping it would return varchar char varchar varchar decimaln why are the results not as expected ? How can i get the proper column types ? I intend to use this information later to create a dynamic query that creates another table. 回答1: You need to join systypes to

Difference between SYS.ALL_TAB_COLUMNS and SYS.ALL_TAB_COLS in Oracle 12c

淺唱寂寞╮ 提交于 2019-12-01 22:10:19
What is the difference between the ALL_TAB_COLUMNS and ALL_TAB_COLS system tables in Oracle 12c? In my DB, the ALL_TAB_COLUMNS has slightly fewer rows than ALL_TAB_COLS. From the Oracle manual for ALL_TAB_COLS This view differs from "ALL_TAB_COLUMNS" in that system-generated hidden columns and invisible columns, which are user-generated hidden columns, are not filtered out. From the Oracle manual for ALL_TAB_COLUMNS This view filters out system-generated hidden columns and invisible columns, which are user-generated hidden columns. The ALL_TAB_COLS view does not filter out hidden columns and

How to check if a Constraint exists in Sql server?

£可爱£侵袭症+ 提交于 2019-11-27 05:51:40
I have this sql: ALTER TABLE dbo.ChannelPlayerSkins DROP CONSTRAINT FK_ChannelPlayerSkins_Channels but apparently, on some other databases we use, the constraint has a different name. How do I check if there's a constraint with the name FK_ChannelPlayerSkins_Channels . try this: SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_NAME ='FK_ChannelPlayerSkins_Channels' -- EDIT -- When I originally answered this question, I was thinking "Foreign Key" because the original question asked about finding "FK_ChannelPlayerSkins_Channels". Since then many people have commented on

How to check if a Constraint exists in Sql server?

 ̄綄美尐妖づ 提交于 2019-11-26 12:49:25
问题 I have this sql: ALTER TABLE dbo.ChannelPlayerSkins DROP CONSTRAINT FK_ChannelPlayerSkins_Channels but apparently, on some other databases we use, the constraint has a different name. How do I check if there\'s a constraint with the name FK_ChannelPlayerSkins_Channels . 回答1: try this: SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_NAME ='FK_ChannelPlayerSkins_Channels' -- EDIT -- When I originally answered this question, I was thinking "Foreign Key" because the

Find all tables containing column with specified name - MS SQL Server

我们两清 提交于 2019-11-26 05:42:11
问题 Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. Is it possible to query for table names which contain columns being LIKE \'%myName%\' ? 回答1: Search Tables: SELECT c.name AS 'ColumnName' ,t.name AS 'TableName' FROM sys.columns c JOIN sys.tables t ON c.object_id = t.object_id WHERE c.name LIKE '%MyName%' ORDER BY TableName ,ColumnName; Search Tables