Find all tables in db with column name of a particular string?
I'm looking for all tables in a db that have a certain column name. How can I find this?
John,
thanks for your answer.
John Mcginnis wrote:
The quick search field in the schema browser is doing client-side filtering of the list of objects. This means we can only filter on things that we already have fetched from the database, like the object name. We have no current plans to extend the types of information that can filter on, although it is possible we might add the ability to filter based on a few other types of information that we generally fetch with the object name. However, filtering by column name would require pre-fetching the lists of columns for all tables and as such is not likely to be added to the schema browsers search field.
I'm sure you guys had a Toad review to understand how things are done there.....so
My 2 cents are: instead of pre-fetching the columns of all tables why don't you add a button below the table drop-down list which should fetch the tables based on the filter columns condition - exactly like Toad.
Thanks,
Dani
Similar Messages
-
Finding a TABLE based on a COLUMN NAME...
I need to find all tables that that have a common column name.
Upon searching the Forum, I found this nice nugget:
How to find the table in a schema if I only know a particular column name
The problem is, my USER_TAB_COLUMNS is EMPTY!
If it had worked, then my statement would be:
select * from USER_TAB_COLUMNS
where COLUMN_NAME LIKE '%TEST%'
and OWNER='ME';
I get "no rows selected" (though I know they exist)
if I do:
select * from USER_TAB_COLUMNS
I also get "no rows selected"
Any ideas!
Thanks!
KSL.The user_xxx data dictionary tables show all of the whatevers that are owned by the logged in user. So, if you are logged in as user1 the user_tab_columns view will only show tables and views owned by user1.
The all_xxx dictionary views show all of the whatevers that the logged in user has access to. so if you are logged in as user1 and user2 gave you selet privileges on tablea, then you would see tablea in all_tab_columns.
The dba_xxx views show all objects in the database, but are generally only available to privileged users.
If you have access to the dba_views, try:
SELECT owner, object_type
FROM dba_objects
WHERE UPPER(object_name) = 'ANL'It is possible that the table and or its columns were created with double quotes so are case sensitve. It may also be a synonym, pointing to one of the tables that you got form your query.
If you are only using all_tab_columns then it is possible that the user you are logged in as does not have privileges on the table anl so would not see it in the view.
A long shot, but are you sure you are in the right database?
John -
How to find all tables that are associated with a given domain name.
I want to find all table, excluding the structures, of a given domain name, say, waers.
Some of the tables are directly contains the domains while others are related with a data element which is connected to that domain.
I want to find tables for all two case -either tables connected directly to the domain or connected via data element- and exclude the structures.
thanks in advance.Hi,
The following thing may help you.
in se11-> search for tables having names like 'DD*'.
From this list of tables you can find the required table to get domain, data element nad table name.
one way of doing it:
SELECT rollname domname
FROM dd04l
INTO CORRESPONDING FIELDS OF TABLE it_tab.
SELECT rollname tabname
FROM dd03l
INTO CORRESPONDING FIELDS OF TABLE it_tab1
FOR ALL ENTRIES IN it_tab
WHERE rollname = it_tab-rollname.
SORT it_tab1.
DELETE ADJACENT DUPLICATES FROM it_tab1.
LOOP AT it_tab1 INTO wa_tab.
MODIFY it_tab FROM wa_tab
TRANSPORTING tabname
WHERE rollname = wa_tab-rollname.
ENDLOOP.
LOOP AT it_tab INTO wa_tab.
WRITE:/ wa_tab-domname,
wa_tab-tabname.
ENDLOOP.
Regards,
Manoj Kumar P -
Migrating from Sql Server tables with column name starting with integer
hi,
i'm trying to migrate a database from sqlserver but there are a lot of tables with column names starting with integer ex: *8420_SubsStatusPolicy*
i want to make an offline migration so when i create the scripts these column are created with the same name.
can we create rules, so when a column like this is going to be migrated, to append a character in front of it?
when i use Copy to Oracle option it renames it by default to A8420_SubsStatusPolicy
Edited by: user8999602 on Apr 20, 2012 1:05 PMHi,
Oracle doesn't allow object names to start with an integer. I'll check to see what happens during a migration about changing names as I haven't come across this before.
Regards,
Mike -
JTable - Help with column names and rowselection
Hi,
Is there anyone that can help me. I have successfully been able to load a JTable from an MS access database using vectors. I am now trying to find out how to hardcode the column names into the JTable as a string.
Can anyone please also show me some code on how to be able update a value in a cell (from ''N'' to ''Y'') by double clicking on that row.
How can I make all the other columns non-editable.
Here is my code:
private JTable getJTable() {
Vector columnNames = new Vector();
Vector data = new Vector();
try
// Connect to the Database
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
// String url = "jdbc:odbc:Teenergy"; // if using ODBC Data Source name
String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Documents " +
"and Settings/Administrator/My Documents/mdbTEST.mdb";
String userid = "";
String password = "";
Class.forName( driver );
Connection connection = DriverManager.getConnection( url, userid, password );
// Read data from a table
String sql = "select * from PurchaseOrderView";
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery( sql );
ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();
// Get column names
for (int i = 1; i <= columns; i++)
columnNames.addElement( md.getColumnName(i) );
// Get row data
while (rs.next())
Vector row = new Vector(columns);
for (int i = 1; i <= columns; i++)
row.addElement( rs.getObject(i) );
data.addElement( row );
rs.close();
stmt.close();
catch(Exception e)
System.out.println( e );
if (jTable == null) {
jTable = new JTable(data, columnNames);
jTable.setAutoCreateColumnsFromModel(false);
jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN);
jTable.setShowHorizontalLines(false);
jTable.setGridColor(java.awt.SystemColor.control);
jTable.setRowSelectionAllowed(true);
jTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jTable.setShowGrid(true);
return jTable;
}this method has a default behavior to supply exactly what you're seeing: column names consisting of the capitalized letters, "A", "B", "C".Thanks Pete, had seen that but never really thought about it... about 10 days ago somebody needed to obtain Excel column names, I'd offered a rigorous solution and now see it would have been shorter and simpler (if a little heavier) to extend DefaultTableModel and provide the two additional methods needed (getOffsetCol and getColIndex).
Not much of a difference in LOC but certainly more elegant ;-)
Darryl -
Find all tables used in a stored procedure
Hi,
I have a requirement where i have to find all the tables used in a stored procedures from different databases.
Ex: i have a stored procedure where i use few tables from MASTER database and some from STAGE database.When i have written a query to find all tables used in the stored procedure, i am getting only those database table where i run the query and procedure
exists.
I have stored procedure SP1 in Master database, but i use the tables from both master and stage.
When i run this, i am getting the tables only from Master database but not from stage. i hope my requirement is clear.
I am trying to find all the tables from all databases used by a stored proc.
;WITH stored_procedures AS (
SELECT
o.name AS proc_name, oo.name AS table_name,
ROW_NUMBER() OVER(partition by o.name,oo.name ORDER BY o.name,oo.name) AS row
FROM sysdepends d
INNER JOIN sysobjects o ON o.id=d.id
INNER JOIN sysobjects oo ON oo.id=d.depid
WHERE o.xtype = 'P')
SELECT proc_name, table_name FROM stored_procedures
WHERE row = 1
ORDER BY proc_name
Please adviceYour question is not entirely clear. You need to run the query on different databases.
You may find this blog post helpful
How to get information about all databases without a loop
Check the last script in that blog post and modify to your particular purpose.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
Error in nested group function used with column name.
Hi Team,
If i used nested group function with column name its not working. Could you please any one suggest me.
How to use it.
Regards,
Venkat.
Please find Spool ........
SQL> select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
2 group by user_name,CNT;
select user_name,max(max(CNT)) from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
ERROR at line 1:
ORA-00937: not a single-group group function
SQL> select max(max(CNT)) from(select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
2 group by user_name;
MAX(MAX(CNT))
605Venkat wrote:
Hi Sayan
Its giving output like below, but not given maximum CNT.
SQL> select user_name,max(CNT)from (select USER_NAME,count(*) CNT from v$open_cursor group by USER_NAME)
2 group by user_name;
USER_NAME MAX(CNT)
BANES_LERG 6
VENE_USER 8
USER3 339
DBUS 106
VEL_USER 37
SYS 597
6 rows selected.Check it - Re: Error in nested group function used with column name.
and previous post -
How to find all table and views in the database
Hi,
I want to find all table and view name form the database can u tell me syntax.
i.e. I am able to find out table name and view name in sql server ...like
FOR VIEW :
select table_name from information_schema.views where table_name not like 'sys%'
FOR TABLE :
select table_name from information_schema.tables where table_name not like 'sys%' and table_type='Base table'
Thanks & Regards,
ShirishHello,
Take a look at "dba_tables" and "dba_views" both of which are documented here:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14237/toc.htm
- Mark -
Bcp queryout with column name in output
DECLARE @cmd nvarchar(1000);
SELECT @cmd = 'bcp "SELECT ObjectID,FeatureID,ParcelID,Card,ISNULL(Units,0) as Units,ISNULL(Bed,0) as Bed,ISNULL(Bath,0) as Bath,ISNULL(Half,0) as Half,TaxYear FROM pubtables.dbo.Tax_StructureApartment" queryout "\\WDC1GISSHP1\Scripts\DataManagement\DataMaintenance\SyncDataCatalog2SDE\CAMA.txt" -T -c';
PRINT @cmd
exec xp_cmdshell @cmd;
I am extracting certain fields from a large table and using bcp to output to a file. The code above works, but the output does not have the column name (i.e. header). How would I go about doing that ?
Thank you.you need to add a query based on catalog view information_schema.columns for that
see this example
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/10/10/export-to-excel-with-column-names.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Adobe Acrobat Pro cannot find moved files or files with edited names
Adobe Acrobat X Pro 10.1 cannot find recent files or files with edited names.
For instance, if a PDF file is moved in the hard disk from one foder to another, Acrobat cannot find it when trying to open it via "File - Open Recent File".
Likewise, if the name of the file is changed in the Finder.
Similarly, if a PDF file is open, it is marked with the yellow fluorescent marker of Acrobat, its name is then changed in the Finder and later on you try to save it, Acrobat says that it cannot find such file.
Yet, applications like Microsoft Word do not have any of the above problems. It would be great if Adobe could fix these serious productivity issues, which have plagued Acrobat for many years now.
How to send such feedback to Adobe?https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
-
Getting column names for a particular Table from Connection object.
Hi,
Can any one suggests me a way to get column names from a particular table of a database from the java.sql.Connection object. ?
Thanks in advance.Connection connection;
DatabaseMetaData metadata = connection.getMetaData();
String[] names = {"TABLE"};
ResultSet tables = metadata.getTables(null,"%", "%", names);
while (tables.next()) {
String tableName = tables.getString("TABLE_NAME");
ResultSet columns = metadata.getColumns(null, "%", tableName, "%");
while (columns.next()) {
String columnName = columns.getString("COLUMN_NAME");
} -
Poweshell script to parse a XML document to get all Leaf level nodes with Node names in CSV
Hi Experts,
I want to write a Powershell script to parse a XML document to get all Leaf level nodes with Node names in CSV
<?xml version="1.0" encoding="UTF-8"?>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
</CATALOG>
Need to display this as
CD_Tiltle, CD_ARTIST, CD_COUNTRY, CD_COMPANY, CD_PRICE, CD_YEAR
Empire Burlesque, Bob Dylan,USA,Columbia,10.90,1985
and so on..
I do not want to hard code the tag names in the script.
current example is 2 level hierarchy XML can be many level till 10 max I assume
in that case the csv file field name will be like P1_P2_P3_NodeName as so on..
Thanks in advance
PrajeshThankfully, I have writtenscript for ths same $node_name="";
$node_value="";
$reader = [system.Xml.XmlReader]::Create($xmlfile)
while ($reader.Read())
while ($reader.Read())
if ($reader.IsStartElement())
$node_name += "," + $reader.Name.ToString();
if ($reader.Read())
$node_value += "," + $reader.Value.Trim();
Thanks and Regards, Prajesh Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. -
Find all Package and their related Procedure Names using a specifc Table
I have 25 Packages
Each Package holds 30-35 Procedures
I need to find out all Packages and Procedures
Each Procedure handles 5 - 20 Tables as Per The Need of Business Rule.
I need All Package and Related Procedure Names Where a Specific Table Name Appears(DBA_SOURCE doesn't serve purpose.)
Early Reply Appreciated.
Thanks and Regards,I tried the solution provided to me, but unfortunately the issue remains the same.
I was Advised to Execute the SQL utldtree.Sql, and then Execute deptree_fill.
The output is given by a Table DEPTREE (Columns are: .'NESTED_LEVEL', 'TYPE', 'SCHEMA', 'NAME' and 'SEQ#')
The output I am getting From the Table DEPTREE is as follows -
Column TYPE value is PACKAGE; Column NAME Value is ACTUAL PACKAGE NAME
Column TYPE value is PACKAGE BODY; Column NAME Value is ACTUAL PACKAGE NAME
This repeats till the count the TABLE Name is found in the same PACKAGE
Desired Output should be -
Column TYPE value PACKAGE; Column NAME Value ACTUAL PACKAGE NAME
Column TYPE value PACKAGE BODY; Column NAME Value ACTUAL PACKAGE BODY NAME
This should repeat till the count the TABLE Name appears in different PACKAGE BODY of the same PACKAGE
Warm Regards, -
Find all tables who don't have at least one DATE column
DB version:10gR2
Using user_tab_cols view, How can i find the tables who don't have at least one DATE(user_tab_cols.data_Type='DATE') column?SELECT table_name
FROM user_tables
WHERE table_name NOT IN ( SELECT DISTINCT
table_name
FROM user_tab_cols
WHERE DATA_TYPE = 'DATE'
);Regards
Arun -
I have named my columns for exaomple column trasanctionid as "TransactionID".But when i write a process and run the query in the process it takes the column name as all in cappital letters.Hence it gives me follwing error.
ORA-00904: "TRANSACTIONID": invalid identifier
I want to know whether there is any constraint to name columns all inc apital letters in apex.I am finding it difficult to change column name and then make changes throughout the app for it.This error has popped up many times for me and I had to everytime change the column anme to all capitals to get rid of this error.
Edited by: dwitiya on Sep 3, 2010 10:52 AMGlad to hear it.
And as you can see from the other responses, case sensitive column names are not widely understood (many people assume they don't exist), so it's really best to avoid them wherever possible. The only time I've seen column names defaulting to case sensitive was when we imported a table from Microsoft Excel using a third-party tool (Toad). This caused us a rather significant amount of headache, and it's something I've been careful to check for ever since.
Of course, once a table or a column is created with a case-sensitive name, it can be hard to break free, as you're discovering--you can't just alter the table and rename the column, as your existing code will break. (transactionid is equal to "TRANSACTIONID", but not "TransactionID".) So if you're not willing to go through your entire codebase to fix the case-sensitivity (and most of us don't have time to), you're going to have to get used to putting quotes on the things that need it.
Which will, of course, help you remember to make your table and column names case-insensitive in the future. :-)
-David
Edited by: DavidG on Sep 3, 2010 11:17 AM: realized I'd mis-typed a variable name.
Maybe you are looking for
-
Report to show changes in special prices
Hi All We are having a problem currently where some users change the prices in the system and since the special prices table or price table does not have a log it makes it difficult to check who changed the prices from what price to what price and wh
-
Calendar crashes in month view mode
iPad 2 - iOS 5. Using Calendar app, viewing in month mode. Paging from month to month. When I page from february 2013 to march 2013, the app crashes. Consistently. Is it just me?
-
I just downloaded the new version of itunes to my PC and now it won't allow me to login
I just downloaded the newest version of iTunes to my PC and I went to login to my account to change some of the settings, but now it will not allow me to do so. I even went in and changed my password and it still will not allow me to log in. I was ab
-
Sony Bravia 2006 will not recognize AppleTV
I cannot seem to successfully connect my Apple TV to my Sony Bravia KDL40S2000. I've followed all the suggestions I can find online: I have connected the AppleTV to the Sony Bravia with multiple HDMI cables. The HDMI port is active, and works with ot
-
HELP!