Want to know query to list all tables in oracle database? we have a huge selection of query to list all tables in oracle database information on alibabacloud.com
There may be many tables in a database, and I would like to delete them all if one manual removal is too cumbersome and a waste of time.Two questions involved: 1. How do I know which tables are in this database? 2. How do I read these table names?These two problems have been
ASP. NET dataset facilitates the use of XML files on the page. How can I convert all your data in a database? If your database is compatible with oledb, let's take a look at how to convert all the tables in the database into XML f
1. Query all tables in sql:
Select table_name from database name. Information_schema. Tables Where table_type= ' BASE table ' is executed, you can see the names of all the tables in th
Label:Use test--Delete all (constraint F)DECLARE @countF INTSET @countF = (SELECT COUNT (*) from test.sys.objects WHERE type = ' F ')PRINT ' A total of ' + CAST (@countF as VARCHAR (5)) + ' constraint. ‘While @countF >0BEGINDECLARE @F_Name VARCHAR (50)DECLARE @tbName VARCHAR (50)DECLARE @Cmd VARCHAR (100)DECLARE @parent_Object_ID INTSET @F_Name = (SELECT TOP (1) Name from test.sys.objectsWHERE name in (SELECT t.name from test.sys.objects as [t]) and t
If there are more than two associated tables in an SQL statement, what is the order of connection? ORACLE first connects two tables to generate a result set, and then associates the generated result set with the next table. continue until all tables are connected; finally, w
DECLARE @t varchar(255),@c varchar(255)DeclareTable_cursorcursor for SelectA.name,b.name fromsysobjects a,syscolumns b, systypes cwherea.ID=b.ID andA.xtype='u' andC.name/*"U" is the type of data you want to manipulate, do not change to all data types, don't want to bother to change*/inch('Char','nchar','nvarchar','varchar','text','ntext' /*--here if your text (ntext) type does not have more than 8000 (4000) length, you can use*/)Declare @str varchar
MQT that creates a REFRESH IMMEDIATE type. This table, named EMP, is based on the underlying table EMPLOYEE and DEPARTMENT in the SAMPLE database. Since the REFRESH IMMEDIATE MQT requires at least one unique key from each table referenced within the query to appear in the select list, we first define a uniqueness constraint on the EMPNO column of the EMPLOYEE ta
Use the following stored procedure: If the input table name is used, the table is taken out. If the table name is not used, the entire table structure is selected. If you have any questions, continue to ask me. -- This stored procedure retrieves the field information of the input table. If the table name is blank, it lists information about all the tables in the current
-- Change the smalldatetime column of all tables in the current database to nvarchar (20)
-- If the column contains indexes, default values, and other dependencies, it cannot be modified.
Exec sp_msforeachtable
@ Command1 = N'
Declare cur cursor local
For
Select
N'alter table? Alter column''
+ Quotename (C. Name)
+ N'nvarchar (20 )''
From syscolumns C
--> Title: delete data in all tables of a user in the database.
--> Author: wufeng4552
--> Date: 15:08:41
-- Method 1
Copy codeThe Code is as follows: declare @ uname varchar (20)
Declare cuser cursor
Select so. name
From sysobjects so, sysusers su where so. uid = su. uid and su. name = 'stone'
And so. xtype = 'U'
Open cuser
Fetch next from cuser into @
--> Title: delete data in all tables of a user in the database.--> Author: wufeng4552--> Date: 15:08:41-- Method 1Copy codeThe Code is as follows:Declare @ uname varchar (20)Declare cuser cursorSelect so. nameFrom sysobjects so, sysusers su where so. uid = su. uid and su. name = 'stone'And so. xtype = 'U'Open cuserFetch next from cuser into @ unameWhile (@ fetch_
Traverse all tables in the database and update the values of datetime columns.
Declare @ tablename nvarchar (80) declare @ cloumn nvarchar (80) declare @ SQL nvarchar (400) declare c1 cursor scroll forselect table_name, column_name from information_schema.columns where DATA_TYPE = 'datetime' open c1fetch first from c1 into @ tablename, @ cloumnwhile @ fetch_stat
--> Title: delete data in all tables of a user in the database.--> Author: wufeng4552--> Date: 15:08:41-- Method 1Declare @ uname varchar (20)Declare cuser cursorSelect so. NameFrom sysobjects so, sysusers su where so. uid = Su. UID and Su. Name = 'stone'And so. xtype = 'U'Open cuserFetch next from cuser into @ unameWhile (@ fetch_status = 0)BeginExec ('truncate
Hard to import data into the database, but found that forget to create a script to forget PK.
Fortunately, the table has a regular, each table has an [ID] int field, PK is built on it.
Note:
1 for the readability of the code, not using the ' SQL splicing ' method, but the use of ' first placeholder, after replacement ' method-see the inside of the replace statement. Recommend to everyone
2 because it is executing the DDL, for careful consideration
Tags: Dex objects code and Space Pre ONS table containeSELECTTableName=obj.name,totalrows=Prt.rows,[spaceused (KB)] = SUM(alloc.used_pages)*8 fromsys.objects objJOINSys.indexes IDX onObj.object_id =Idx.object_idJOINSys.partitions PRT onObj.object_id =Prt.object_idJOINSys.allocation_units Alloc onalloc.container_id=prt.partition_idWHEREObj.type= 'U' andidx.index_idinch(0,1)GROUP byObj.name, Prt.rowsORDER by SUM(alloc.used_pages)*8 DESCSQL queries the number of record bars for
1. query all tables in SQL:Select TABLE_NAME FROM database name. INFORMATION_SCHEMA.TABLES Where TABLE_TYPE = 'base table' after execution, you can see the names of all tables created by yourself in the
1. query all tables in SQL:
Select TABLE_NAME FROM database name. INFORMATION_SCHEMA.TABLES Where TABLE_TYPE = 'base table' after execution, you can see the names of all tables created by yourself in the
Query all table names: Select T.table_name from User_tables t; Query all field names: Select T.column_name from user_col_comments t; Query all field names for the specified table: Select T.column_name from user_col_comments t
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.