How to allow space in the column names
Hi
My program reads data from an excel file which has columns named "Fiscal Year" and "current period". I can read data from the file as below...
select * from the_file
But it does not allow me, if I write the following sql statement.
select distinct fiscal Year, current period from the_file
I need to get distinct values from these two columns and the order in which these columns will appear in excel file is not fixed.
I tried
select distinct 'fiscal Year', 'current period' from the_file
But it did not work
Please help as how can I specify these columns that has a space in its name.
Thanks
Have you tried Double quotes as in:
select distinct "fiscal Year", "current period" from the_file;
Similar Messages
-
How can I list all the column names of a table by programming?
Hi,
Now I want to write an function which has the following features:
Firstly, The function was given a parameter as table name.
Then, it will lists all the columns names of the table.
e.g
table: person
---firstName------lastName----+
Michale Jackson
We can get the columns 'firstname' and 'lastName' by calling the function with table name 'person'.
And I also wonder that where I can get reference book or any other materials?
Thanks.
Edited by: wenjing wang on Feb 15, 2008 6:42 AM
Edited by: wenjing wang on Feb 15, 2008 6:57 AMhi,
hope the below code helps u. Just take the headee which contains the field name and split it like below and compare it with the field name u want here 'last name'.
here,
'First name' will be in wt_filedata1 and remaining field names in wt_filedata2, so 'do' continues.
c_tab must be the separator, either , or + or tab etc..
CODE:
read table person into wl_header index 1.
do.
split wl_header at c_tab into: wt_filedata1 wt_filedata2.
if wt_filedata1 <> 'lastname'.
cnt1 = cnt1 + 1.
wl_header = wt_filedata2.
else.
exit.
endif.
enddo.
Please reward if it is useful.
regards,
sri -
How to add spaces to the column value to make it up specifi length string please
Hello There,
Could you please guide me here to solve this issue,
in my column (named as State) contains values as below
California
Washington
Utah
Connecticut
Massachusets
in the output how can i add a spaces to make up every column values as 15 length (for ex, Utah is 4 length then need to add 11 spaces, California is 10 would like to add 5 spaces)
i tried below but no use in Sql 2008 R2
SELECT distinct state
state
+SPACE(35-len(state)),
len(state+SPACE(35-len(state)))
FROM dbo.ordersInfo
Thank you in advance
MilanFixed length CHAR(n) data in SQL is automatically padded with spaces. Either change the column's data type or cast to it. Also, the ISO-11179 rules are that the column should be "state_name" and not just the root attribute "state" -- state_code, state_population,
etc are a few of the confusions you created.
Another rule of RDBMS is that we do not do display formatting in the data. That is what presentation layers do. Why are you trying to fake COBOL in SQL?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
How to replace variant to the column name to set value?
e.g.:i have many columns in my table.now i need to control of the visual attribute.now i hope iterator the columns to set visual value.
for example:i have a node testNode and a value attribute named testValue of it.i bind it to the some context.
now i hope used such code to operate it:
<b>String x="testValue";
wdContext.currentTestNodeElement.setx(WDVisibility.VISIBLE);</b>
you know it cann't run.who can give me some advices on it.Create a value node called "ColumnVisibility" ( <b>with cardinality 1:1 </b>) under the root context.
Create as many value attributes ( datatype: ddic:com.sap.ide.webdynpro.uielementdefinitions.Visibility ) as the number of columns in your table and bind them to the visibility property of the appropriate columns.
(For example: The attributes ColumnOneVisibility, ColumnTwoVisibility, ColumnThreeVisibility are bound to column1, column2, column3).
Now use this code to control the visibility of columns
String[] attributeNames = {"ColumnOneVisibility", "ColumnThreeVisibility","ColumnTwoVisibility"};
for(int k = 0; k < attributeNames.length; k++)
IWDNodeElement columnVisibilityElement =
(IWDNodeElement)wdContext.currentColumnVisibilityElement();
/** Use your condition here */
/** and set WDVisibility to VISIBLE or NONE depending upon the requirement*/
columnVisibilityElement.setAttributeValue(attributeNames[k],(WDVisibility) WDVisibility.NONE);
Bala
Message was edited by: Bala Krishnan -
How to allow website using the domain name in zone based firewall ?
Hi,
I need to give a restricted access to internet by allowing few sites. How will I do it with the url of a particular website. If I put the url in the configuration it resolves to only a single IP. How will I do it for a website like google where there are numerous number of IP addresses.
Regards,
TonyHi Bro
Please kindly refer to this URL https://supportforums.cisco.com/docs/DOC-17014
I hope this is what you're looking for :-)
P/S: If you think this comment is helpful, please do rate it nicely :-) -
How to use the column names generated from Dynamic SQL
Hi,
I have a problem with Dynamic SQL.
I have written an SQL which will dynamically generate the Select statement with from and where clause in it.
But that select statement when executed will get me hundreds of rows and i want to insert each row separately into one more table.
For that i have used a ref cursor to open and insert the table.
In the select list the column names will also be as follows: COLUMN1, COLUMN2, COLUMN3,....COLUMNn
Please find below the sample code:
TYPE ref_csr IS REF CURSOR;
insert_csr ref_csr;
v_select VARCHAR2 (4000) := NULL;
v_table VARCHAR2 (4000) := NULL;
v_where VARCHAR2 (4000) := NULL;
v_ins_tab VARCHAR2 (4000) := NULL;
v_insert VARCHAR2 (4000) := NULL;
v_ins_query VARCHAR2 (4000) := NULL;
OPEN insert_csr FOR CASE
WHEN v_where IS NOT NULL
THEN 'SELECT '
|| v_select
|| ' FROM '
|| v_table
|| v_where
|| ';'
ELSE 'SELECT ' || v_select || ' FROM ' || v_table || ';'
END;
LOOP
v_ins_query :=
'INSERT INTO '
|| v_ins_tab
|| '('
|| v_insert
|| ') VALUES ('
|| How to fetch the column names here
|| ');';
EXECUTE IMMEDIATE v_ins_query;
END LOOP;
Please help me out with the above problem.
Edited by: kumar0828 on Feb 7, 2013 10:40 PM
Edited by: kumar0828 on Feb 7, 2013 10:42 PM>
I Built the statement as required but i need the column list because the first column value of each row should be inserted into one more table.
So i was asking how to fetch the column list in a ref cursor so that value can be inserted in one more table.
>
Then add a RETURNING INTO clause to the query to have Oracle return the first column values into a collection.
See the PL/SQL Language doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/returninginto_clause.htm#sthref2307 -
How to select even the column names of a table?
Hello All,
Is there a way to select even the column names of a table in the select statement?
My select from a table (say X) is in a SQL* Plus script that gets invoked by application tier and displays data in the application tier window. User's can then copy the data into a spreadsheet and do their processing. However, I need to give them the column names too along with the data.
Thanks,
ChiruIf there is a middle tier that is selecting and
displaying the data, and that's what the users are
copying from, the middle tier would have to address
its presentation of the data to allow users to
include column names. If this is a common task, the
application should probably be modified to give users
the option of downloading the data in a spreadsheet
directly rather than forcing them to copy and paste
data.Thanks for the reply.
The users don't have to copy paste. The application tier has an options in the "Tools" menu item which allows them to copy the entire output to a file (in my case a txt file which is a pipe delimited). Then they have to do text to columns to get the data into each column of the spreadsheet. I could have directly called the stored procedures from the application tier and created ".csv" files and FTP'd them to the user's folders. However, I am having to go this round about because, I am not getting enough support from the LAN team in FTP'ing etc.
OK I'll think of another workaround.
Thanks,
Chiru -
How to access a url in file receiver CC with space in the folder name?
Hi
PI 7.11 sp4:
In a file receiver channel I would like to send the message to this folder:
de-prod.dk\bu\something\something\PTI eventstanden\archive\"
But I get this error message:
"Target directory 'F:\usr\sap\XP7\DVEBMGS02\j2ee\cluster\server0\"\de-prod.dk\bu\something\something\PTI eventstanden\archive"' does not exist"
My question is: where the f.... does it get the 'F:\usr\sap\XP7\DVEBMGS02\j2ee\cluster\server0\ from, and how can I fix it?
One issue is the space in the folder name. I have tried to replace the space with %20 and then remove the "" s around the whole url, but without any luck.
When I log on the server on which Pi is running I can access the folder using the mentioned url including the ""s.
All suggestions would be highly appreciated!
MIkael> But I get this error message:
>
> "Target directory 'F:\usr\sap\XP7\DVEBMGS02\j2ee\cluster\server0\"\de-prod.dk\bu\something\something\PTI eventstanden\archive"' does not exist"
>
> My question is: where the f.... does it get the 'F:\usr\sap\XP7\DVEBMGS02\j2ee\cluster\server0\ from, and how can I fix it?
It comes from the "
Anything else but \ is treated as local folder under working directory of PI
> One issue is the space in the folder name. I have tried to replace the space with %20 and then remove the "" s around the whole url, but without any luck.
It works for me just to copy the folder from Windows explorer into channel config. With space and without ". -
I am using OSX 10.9.5 and Outlook Web App for emails. When I download an attachment it replaces the space in the file name with %20 - how can I change this?
Click on the below link :
https://get.adobe.com/flashplayer/otherversions/
Step 1: select Mac OS X 10.6-`0.`0
Step 2 : Safari and FIrefox
Then click on " Download Now" button. -
Hi,
I am using OCCI to interact with DB through code, which means I am writing a vc++ file to interact with Data Base and execute the Stored Procedure which I am calling from the C++ Code. And also displaying the output of the Stored Procedures to the Front End. I am succeeded in this, but now I should be able to display the Column names of the output to Front End. Can any one help me on this.
Example:
Sno | Sname
------- |-------------
1 ABC
2 DEF
I am getting (1,ABC) and (2,DEF) as the output of the Stored Procedure but I need the Column names also to display. How to get them.
Thanks in Advance..:)Look at Re: exporting csv via pl/sql - select statement?
It has an example how to extract the column name from a cursor. You have to check, whether you can use DBMS_SQL.DESCRIBE_COLUMNS
Your procedure might need another out parameter, that returns the column names , e.g. as comma separated list or as varray. -
How to rename the column name in oracle 8i?
hi,
Does anyone know how to rename the column name in oracle 8i?My method was drop the relationship key first then delete the old column,finally add the new column.
Thanks for your replay.
jingThere is no facilty to rename a column name in Oracle 8i. This is possible from Oracle 9.2 version onwards.
For you task one example given below.
Example:-
Already existed table is ITEMS
columns in ITEMS are ITID, ITEMNAME.
But instead of ITID I want ITEMID.
Solution:-
step 1 :- create table items_dup
as select itid itemid, itemname from items;
step 2 :- drop table items;
step 3 :- rename items_dup to items;
Result:-
ITEMS table contains columns ITEMID, ITEMNAME -
How to get the column names of the table into the Dashboard prompt
how to get the column names of the table into the Dashboard prompt
Thanks & Regards
Kishore PHey john,
My requirement is as follows
I have created a Rank for Total sales by Region wise i.e RANK(SUM(Dollars By Region)) in a pivot table.
My pivot table looks like this
COLUMN SELECTOR: TOTAL US , REGION , DISTRICT , MARKET
---------------------------------------------------- JAN 2009 FEB 2009 MAR 2009
RANK REGION DOLLARS DOLLARS DOLLARS DOLLARS
1 CENTRAL 10 20 30 40
2 SOUTHERN 10 30 30 70
3 EASTERN 20 20 20 60
4 WESTERN 10 20 30 40
When i select the District in column selector
Report has to display rank based on Total Sales by District. i.e
------------------------------------------------- JAN 2009 FEB 2009 MAR 2009
RANK DISTRICT DOLLARS DOLLARS DOLLARS DOLLARS
for this i need to change the fx of rank i.e RANK(SUM(Dollars By Region)) to RANK(SUM(Dollars By District)) and fx of Region i.e Markets.Region to Markets.District dynamically.
so , i need to capture column name of the value selected from the column selector and dynamically i need to update the fx 0f RANK & fx of region.
do you have any solution for this?
http://rapidshare.com/files/402337112/Presentation1.jpg.html
Thanks & Regards
Edited by: Kishore P on Jun 24, 2010 7:24 PM
Edited by: Kishore P on Jun 24, 2010 7:28 PM -
How can i get the column names in CSV file.
Hi,
After execution of infospoke i can not see the column names in that file.How can i get column of respective infoprovider?
Thanks,
Gananadha LenkaHello Gana,
Actually while exporting the data using Info Spoke, we have the possibility to modify the data that we send. This is possible using transformations.
In your Info Spoke, you have a tab called Transformations.
Here you need to create an implementation and then use BADi to populate data.
Check if you can write a start routine sort of thing here and insert a new record into the internal table by hardcoding with your field headings.
Let me know if you dont know how to create transformations.
Kris... -
Reading csv file how to get the Column name
Hi,
I am trying to read a csv file and then save the data to Oracle.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc:odbc:;Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=.;Extensions=csv,txn");
Statement stmt = c.createStatement();
ResultSet rs = stmt.executeQuery("select * from filename.csv");
while(rs.next())
System.out.println(rs.getString("Num"));
My csv file looks like this:
"CHAM-23","COMPANY NAME","Test","12",20031213,15,16
Number,Environ,Envel,Date,Time
"1","2",3,"4",5
"6","7",8,"9",9
Now is there anyway using the above code I start processing the file from the second row that holds the names of the columns and skip the first row. And also can I get the name of the column using ResultSet something like:
if columnName.equals("Number")
Because I may have a csv file that could have more columns:
"CHAM-24","COMPANY NAME","Test","12",20031213,16,76
Number,Environ,Envel,Date,Time,Total,Count
"1","2","3","4","5",3,9
"6","7","8","9",9",,2
So I want to get the column name and then based on that column I do some other processing.
Once I read the value of each row I want to save the data to an Oracle Table. How do I connect to Oracle from my Application. As the database is on the server. Any help is really appreciated. ThanksThe only thing I could think of (and this is a cluj) would be to attempt to parse the first element of each row as a number. If it fails, you do not have a column name row. You are counting on the fact that you will never have a column name that is a number in the first position.
However, I agree that not always placing the headers in the same location is asking for trouble. If you have control over the file, format it how you want. If someone else has control over the file, find out why they are doing it that way. Maybe there is a "magic" number in the first row telling you where to jump.
Also, I would not use ODBC to simply parse a CSV file. If the file is formatted identically to Microsoft's format (headers in first row, all subsequent rows have same number of columns), then it's fine to take a shortcut and not write your own parser. But if the file is not adhering to that format, don't both using the M$ ODBC driver.
- Saish
"My karma ran over your dogma." - Anon -
JTable : How to display an icon near the column name ?
Hi all,
I'd like to display an icon near the column name of my JTable when an user click on the column; the icon specify the sorting applied to the data of JTable.
I know that i have to write a render, but how ?
Cheers.
StefanoHi all,
I found the solution at http://exampledepot.com/egs/javax.swing.table/IconHead.html
Cheers anyway.
Stefano
Maybe you are looking for
-
Can't connect to wireless network from my e2000 router
My network was working fine, then my router turned off spontaneously. The power wasn't lost, everything else in the power strip was still functioning. I got it working again but now I can't connect to the wifi network on any of my devices. I've tried
-
Issue in updating the Huge XML by using updatexml function
Hi All, Database Credentails: Oracle 9i R2. I have a huge xml like this, <Root> <abc></abc> <abc></abc> <abc></abc> </Root> The <abc></abc> will be more than 10000 under the <Root> tag. I have tried to update this xml by using the following script, f
-
Running out of memory... what to do?
I am using a mid-2012 non-retina 13" MacBook Pro that I upgraded with a large SSD and 16 gigs of RAM, but I find myself running out of memory every day. I am developing a DirectX11 game engine in a virtualized Windows 7 environment, and my memory nee
-
My ipod contains music from my Mac now I wish to move those tunes to my Windows PC but the PC reports that the ipod is formatted for a Mac and I have to reformat my ipod. This would mean I would loose my songs. What can I do? G5 DP 2.0 Mac OS X (10
-
FCPX 10.0.6 Sharing Destination
Is there a way to add MPEG Streamclip to the list of destination choices?