How to return all field names in a table
How do you write a report to return all field names in a table? I prefer the field names in a column.
Thanks
Wayne
Hi,
In Oracle it is,
Select column_name from user_tab_cols where table_name = 'Table_Name';
Note: Table_Name should be in capital letters
In MS SQL Server it is,
SELECT Column_Name + ', '
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Table_Name'
Hope this helps!
Thanks
-Azhar
Similar Messages
-
How to get the field names of a table
hi all,
i need to get all field names of a table. here i dont need any data. i need only field names.
initially i used this query, select * from tname;
the problem is if table have 1000 records, all records will be in memory.
how to get this one.
regards
pavan.hi all,
thanks a lot. the query is working.
initially i given this query
select column_name from user_tab_columns where table_name='mytable';
but no rows selected.
and i tried with this,
select column_name from user_tab_columns where table_name='MYTABLE';
this is working fine.
thanks
pavan. -
How to return all fields when updating?
When I update a lead, it only returns fields that are modified but not all fields in the XML.
I noticed the LeadID and LeadFullname values are still being returned when updating which is good.
How can I make it so it will return ALL fields that have values and not just the modified ones when updating?
ThanksI have to query it after getting it back from the queue.
-
How to retrieve the Field Name of a Table
Hi guys,
I'm trying to retrieve the field name of a table in java, but i don't know how to do it. Could somebody help me?Let say i have a table name Itemmaster, then
i want to retrieve its field and display to dos prompt.
Example :
Item No.
Description
Quantity
It is possible to retrieve the fields?
What could be the possible command in java using packages Java.sql.*?
Thanks in advanced...
Best regards,
DharryThe ResultSet class, which is how query results are returned in JDBC, has methods to get at the metadata for the table queried, including column names:
ResultSet resultSet=statement.executeQuery("select * from table");
resultSetMetadata=resultSet.getMetaData();
resultSetMetadata.getColumnLabel(column+1); -
Change All Field Names in a Table to have a Lowercase First Letter
I have an SQL database with many tables. All of the field names in each table start with an Uppercase letter. I would like to programmatically change all of the field names in each table to start with a lowercase letter. Can this be done?
E.g.: "FieldName" to "fieldname"
Thanks.O.K. Just in case anyone else runs into this, I used Carl's answer to guide me in the right direction. This is my final code that created the commands I needed to run a batch (where TMaster is my schema name and the WHERE statement contains
the datatypes in your tables):
SELECT
'EXEC SP_RENAME ''TMaster.'+TABLE_NAME+'.'+COLUMN_NAME+''',
'''+LOWER(SUBSTRING(COLUMN_NAME,1,1))+SUBSTRING(COLUMN_NAME,2,255)
+''',
''COLUMN'''
FROMINFORMATION_SCHEMA.COLUMNS
WHEREDATA_TYPE='int'. -
Can I display or export a list of all field names on a PDF
In Designer 7, is there a way to display all field names (text fields and checkboxes)? Or is there any way to obtain a list of all field names used on a form?
In Acrobat 7, all the field names used on the PDF will appear when you select the Text Field Tool. However, this will only happen when the fields were added using the form tools in built into Acrobat. These forms tools are not accessible in Acrobat when the PDF was created using Designer.
For a PDF created with Designer, you can hover over a field in Acrobat to have a ToolTip display the field name. Unfortunately, this can only be done one field at a time.
Thanks in advance for any info.Here is an example of how to get all the form objects' names within a node in the hierrachy. For a more complex form (with subforms), you will need to check to see if the node is a container. If it is, you will to use this code below to iterate that node.
var objNode = xfa.resolveNode("xfa.form.form1.page1")
for (var i = 0; i < objNode.nodes.length; ++i)
app.alert(objNode.nodes.item(i).name);
Here is an example:
http://66.34.186.88/LiveCycleSamples/.3bbb371.pdf -
How to make all fields mandatory in sales order T- code VA01 initial screen
Dear all,
how to make all fields mandatory in sales order T- code VA01 initial screen itself
The fields are
Sales Organization
Distribution Channel
Division
Sales Office
Sales Group
Regards,
Amar ReddyHi,
You can use Transaction Variant to achieve this functionality.Please go through the following link which helps you in creating the same.
[Link|http://wiki.sdn.sap.com/wiki/display/Snippets/TransactionVariant-AStepbyStepGuidefor+Creation]
Regards,
Phani Prasad -
How to get the field name of an internal table during runtime?
How to get the field name of an internal table during runtime?
Hi Sudhir,
Declare and Use Get Cursor Field in Your Prm to get the field Name of the Intenal Table
Example Code:
<b> DATA: v_field(60). " Insert this code.
GET CURSOR FIELD v_field. " Insert this code.</b>
<b>CHECK v_field = 'ITAB-KUNNR'. " Insert this code. (or)
Write: v_field.</b>
Regards,
Ramganesan K. -
How to give own field name in alvgrid
how to give own field name in alvgrid
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-FIELDNAME = 'KBETR'.
LS_FIELDCAT-REF_FIELDNAME = 'KBETR'.
LS_FIELDCAT-REF_TABNAME = 'KONV'.
APPEND LS_FIELDCAT TO RT_FIELDCAT.
here i want to give field name in output like this
Non-Deductible Tax.
thanks in advanced.Hi Laxman,
Getting your required description is very simple.
Just fill these 3 parameters in your field catalog.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-TABNAME = G_TABNAME.
LS_FIELDCAT-FIELDNAME = 'KBETR'.
LS_FIELDCAT-REF_FIELDNAME = 'KBETR'.
LS_FIELDCAT-REF_TABNAME = 'KONV'.
LS_FIELDCAT-SELTEXT_L = 'NON-DEDUCTIBLE TAX''. "LONG
LS_FIELDCAT-SELTEXT_M = 'NON-DEDUCTIBLE TAX''. "MEDIUM
LS_FIELDCAT-SELTEXT_S = 'NON-DEDUCTIBLE TAX''. "Short
APPEND LS_FIELDCAT TO RT_FIELDCAT.
The Comments besides the desctription tells what kind of format for display is ..
Regards,
Raghav -
Navigate through block and keep all field names available to a report
Dear OTN Members,
when i press a button, it has to go to a BLOCK what i mentioned and it has to collect all field names those having Visual attribute name what i mentioned and this list i want to populate into a new block where i press button? is it possible in any way.
thanks in advanceThank you Mr Natesh,
but for me it is not possible to send the form, the form consists of lot of blocks and again i have to send you SQL scripts to generate respective blocks etc. if you can think of it with example block A with 20 fields, and block B with a field multi record block, here i want to populate all A.20 field names into B. again the fields in A are differentiated with Visual ttributes 2 types. here i want to restrict the list to a perticular VA.
hope you will help me in this. -
How to return all columns starting with E?
How to return all columns starting with E in emp table?
My attempts (below) were unsuccessful.
SQL> SELECT E* from emp;
SELECT E* from emp
ERROR at line 1:
ORA-00936: missing expression
SQL> SELECT E.* FROM EMP;
SELECT E.* FROM EMP
ERROR at line 1:
ORA-00904: "E": invalid identifier
SQL> SELECT EMP.E* FROM EMP;
SELECT EMP.E* FROM EMP
ERROR at line 1:
ORA-00936: missing expressionYou need to do it dynamically:
SQL> var cur refcursor
SQL> declare
co varchar2(40);
begin
for c in (select column_name from cols where table_name = 'EMP' and column_name like 'E%') loop
co := co || c.column_name || ',';
end loop;
open :cur for 'select '|| rtrim(co,',') || ' from emp';
end;
PL/SQL procedure successfully completed.
SQL> print cur
EMPNO ENAME
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
14 rows selected. -
How to check all columns existing in a table?
Hello.
I'm writing a function that returns average value of every numeric column existing in a database.
I have a general idea how to do it, but I need just one more thing, look at the expamle:
select table_name from user_tables where rownum=1
this allows me to select names of all tables, and then I can access them 1 by 1...
But now i have a little problem - how to access all the atributes in selected table in this way?
Oh, and I have a problem with this rownum... For example it works for 1 (shows 1st row - name of first table) but does not for 2, or greater number :(.
And expresions like rownum < 5 work, but rownum > 3 not :/. What may be the reason?
Thank you for help!
Regards.user13483761 wrote:
Thanks a lot! This 3 atributes is all I need, its a way lot easier than I thought before. I simply use cursor loop and your advices.
Almost got working code - but there is 1 error telling that select is incorrect :/. Why is that?
create or replace
FUNCTION SHOW_ALL
RETURN VARCHAR2 IS
v_ret VARCHAR(100):='Null';
BEGIN
DECLARE
CURSOR cur_stats IS SELECT table_name, column_name, data_type
FROM user_tab_columns;
v_zdanie VARCHAR(100);
BEGIN
FOR v_cur IN cur_stats LOOP
IF v_cur.data_type = 'NUMBER'
THEN
strike
--> select 'In table ' || v_cur.table_name || ' average value of ' ||--
--> v_cur.column_name || ' is:' || avg(v_cur.column_name)--
--> into v_zdanie--
--> from v_cur.table_name;--
strike
>
dbms_output.put_line(v_zdanie);
END IF;
END LOOP;
RETURN v_ret;
END;
END SHOW_ALL;
select 'In table ' || v_cur.table_name || ' average value of ' ||
v_cur.column_name || ' is:' || avg(v_cur.column_name)
into v_zdanie
from v_cur.table_name;
sql_developer tells that this 'table or perspective does not exist' or sth like that, I translated from my native language.You are missing lot of things in the function, you are hard coding the return value to null?
What you should do is as below:
remove the part what you have written, i have strike that above. declare a variable your_select_statement VARCHAR2(1000);
your_select_statement := 'select nvl(avg('||v_cur.column_name||'),0) from '||v_cur.table_name;
execute immediate your_select_statement into v_zdanie;
dbms_output.put_line('In table ' || v_cur.table_name || ' average value of ' ||v_cur.column_name || ' is:' ||v_zdanie); -
How to rename a column name in a table? Thanks first!
I tried to drop a column age from table student by writing the
following in the sql plus environment as :
SQL> alter table student drop column age ;
but I found the following error
ORA-00905: 缺少关键字 (Lack of Key word)
I have oracle enterprise edition 8.0.5 installed at windows 2000
thank you
And I want to know how to rename a column name in a table?
thanksIn Oracle 8i, your syntax would have worked. However, if I
recall correctly, in Oracle 8.0, you can't rename or drop a
column directly. One way to get around that problem is to
create another table based on a select statement from your
original table, providing the new column name as an alias if you
want to change the column name, or omitting that column from the
select statement if you just want to drop it. Then drop the
original table. Then re-create the original table based on a
select statement from the other table. Then you can drop the
other table. Here is an example:
CREATE TABLE temporary_table_name
AS
SELECT age AS new_column_name,
other_columns
FROM student
DROP TABLE student
CREATE TABLE student
AS
SELECT *
FROM temporary_table_name
DROP TABLE temporary_table_name
Something that you need to consider before doing this is
dependencies. You need to make a list of all your dependecies
before you do this, so that you can re-create them afterwards.
If there are a lot of them, it might be worthwhile to do
something else, like creating a view with an alias for the
column or just providing an alias in a select. It depends on
what you need the different column name for. -
Hi,
Can we give the filed names start with '/' character, (like /name)? I saw like these field names in standard table MARA. How we create those fields in Z tables?
Thanks.That are fields in Include structure.
Yes u can create field with / in ur ztable.
first create a structure by selection data type radio button in se11.
in that structure create fields with /.
NOTE: field must have 2 /.
i.e ur field must be /str/struct1.
activate it.
now in ur database table goto edit menu select
include->insert
Give ur structure name .
Message was edited by:
Kalpanashri Rajendran -
How to add new field into dynamic internal table
Hello Expert.
how to add new field into dynamic internal table.
PARAMETERS: P_TABLE(30). "table name
DATA: I_TAB TYPE REF TO DATA.
FIELD-SYMBOLS: <TAB> TYPE standard TABLE.
*Create dynamic FS
create DATA I_TAB TYPE TABLE OF (p_table).
ASSIGN I_TAB->* TO <TAB>.
SELECT * FROM (p_table) INTO TABLE <TAB>.
here i want to add one more field into <TAB> at LAST position and my
Field name = field_stype and
Field type = 'LVC_T_STYL'
could you please helpme out .Hi,
Please find the code below.You can add the field acc to your requirement.
Creating Dynamic internal table
TYPE-POOLS: slis.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE, u201C Dynamic internal table name
<fs_dyntable>, u201C Field symbol to create work area
<fs_fldval> type any. u201C Field symbol to assign values
PARAMETERS: p_cols(5) TYPE c. u201C Input number of columns
DATA: t_newtable TYPE REF TO data,
t_newline TYPE REF TO data,
t_fldcat TYPE slis_t_fldcat_alv,
t_fldcat TYPE lvc_t_fcat,
wa_it_fldcat TYPE lvc_s_fcat,
wa_colno(2) TYPE n,
wa_flname(5) TYPE c.
Create fields .
DO p_cols TIMES.
CLEAR wa_it_fldcat.
move sy-index to wa_colno.
concatenate 'COL'
wa_colno
into wa_flname.
wa_it_fldcat-fieldname = wa_flname.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 10.
APPEND wa_it_fldcat TO t_fldcat.
ENDDO.
Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
ASSIGN t_newtable->* TO <t_dyntable>.
Create dynamic work area and assign to FS
CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
ASSIGN t_newline->* TO <fs_dyntable>.
Populating Dynamic internal table
DATA: fieldname(20) TYPE c.
DATA: fieldvalue(10) TYPE c.
DATA: index(3) TYPE c.
DO p_cols TIMES.
index = sy-index.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
Set up fieldvalue
CONCATENATE 'VALUE' index INTO
fieldvalue.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
ENDDO.
Append to the dynamic internal table
APPEND <fs_dyntable> TO <t_dyntable>.
Displaying dynamic internal table using Grid.
DATA: wa_cat LIKE LINE OF fs_fldcat.
DO p_cols TIMES.
CLEAR wa_cat.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
wa_cat-fieldname = wa_flname.
wa_cat-seltext_s = wa_flname.
wa_cat-outputlen = '10'.
APPEND wa_cat TO fs_fldcat.
ENDDO.
Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fs_fldcat
TABLES
t_outtab = <t_dyntable>.
Maybe you are looking for
-
A quick question. Using iCal on Leopard...I noticed the mini-month view doesn't show any marks on it for days that have events. I seem to remember a little dot on the days, in Tiger. Or am I just spoilt looking at the month view on the iPhone, or iPo
-
really have a hard time when leaving the computer on when attending other matters in the house. When returning, the screen is completely black and unable to wake(?) by touching the mouse or touch pad to put my password and be able to use the computer
-
AVCHD to Blu-Ray - Audio Out of Sync
I just burned a test disc from FCP 7 to Blu-Ray using my Mac Pro's SuperDrive and, thusly, AVCHD. The video looks great on my 42" LCD (played from an LG Blu-Ray player), but the audio is slightly out of sync. I'd say it's about 10 frames or so behind
-
I updated my app and now it will not open
I updated home run battle 2 and now it will it will start to open then go back to my desktop ....don't want to dealt it and loose my data ???
-
[SOLVED] Grub error 18 - cannot boot to Windows
Earlier today I tried to install Arch 64bit (I had 32bit earlier) with kdemod to test new KDE4.2. However, after installation I could not boot neither Arch nor Windows. Grub appeared, but every single option gave me an error. I can't remember anymore