How to determine length of table row in sql 2005
How, other than by doing the addition on my own, can I detemrine the length of a row in a table?
TIA,
barkingdog
EDM,
Is this still an issue?
Thank you!
Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
Small Basic,
Wiki Ninjas,
Wiki)
Answer an interesting question?
Create a wiki article about it!
Similar Messages
-
How to join two internal table rows in alternative manner into one internal table?
How to join two internal table rows in alternative manner into one internal table?
two internal tables are suppose itab1 & itab2 & its data
Header 1
Header 2
Header 3
a
b
c
d
e
f
g
h
i
Header 1
Header 2
Header 3
1
2
3
4
5
6
7
8
9
INTO itab3 data
Header 1
Header 2
Header 3
a
b
c
1
2
3
d
e
f
4
5
6
g
h
i
7
8
9Hi Soubhik,
I have added two additional columns for each internal table.
Table_Count - It represents the Internal Table Number(ITAB1 -> 1, ITAB2 -> 2)
Row_Count - It represents the Row Count Number, increase the row count value 1 by one..
ITAB1:
Header 1
Header 2
Header 3
Table_Count
Row_Count
a
b
c
1
1
d
e
f
1
2
g
h
i
1
3
ITAB2:
Header 1
Header 2
Header 3
Table_Count
Row_Count
1
2
3
2
1
4
5
6
2
2
7
8
9
2
3
Create the Final Internal table as same as the ITAB1/ITAB2 structure.
"Data Declarations
DATA: IT_FINAL LIKE TABLE OF ITAB1. "Final Internal Table
FIELD-SYMBOLS: <FS_TAB1> TYPE TY_TAB1, "TAB1
<FS_TAB2> TYPE TY_TAB2. "TAB2
"Assign the values for the additional two column for ITAB1
LOOP AT ITAB1 ASSIGNING <FS_TAB1>.
<FS_TAB1>-TABLE_COUNT = 1. "Table value same for all row
<FS_TAB1>-ROW_COUNT = SY-TABIX. "Index value
ENDLOOP.
"Assign the values for the additional two column for ITAB2
LOOP AT ITAB2 ASSIGNING <FS_TAB2>.
<FS_TAB2>-TABLE_COUNT = 2. "Table value same for all row
<FS_TAB2>-ROW_COUNT = SY-TABIX. "Index value
ENDLOOP.
"Copy the First Internal Table 'ITAB1' to Final Table
IT_FINAL[] = ITAB1[].
"Copy the Second Internal Table 'ITAB2' to Final Table
APPEND IT
LOOP AT ITAB2 INTO WA_TAB2.
APPEND WA_TAB2 TO IT_FINAL.
ENDLOOP.
"Sort the Internal Table based on TABLE_COUNT & ROW_COUNT
SORT IT_FINAL BY ROW_COUNT TABLE_COUNT.
After sorting, check the output for IT_FINAL Table, you can find the required output as shown above.
Regards
Rajkumar Narasimman -
How to use a Sybase table in Oracle SQL statement?
How to use a Sybase table in Oracle SQL statement?
Sybase version : 11.9.2.4
Oracle version : 10.2.05
Thanks.user12088323 wrote:
How to use a Sybase table in Oracle SQL statement?
Sybase version : 11.9.2.4
Oracle version : 10.2.05
Thanks.Any Oracle client connected to the Oracle database can access Sybase data through the <font style="background-color: #FFFFCC">Database Gateway for Sybase</font> (it requires an additional license) or the <font style="background-color: #FFFFCC">Database gateway for ODBC</font> (it's free).
The Oracle client and the Oracle database can reside on different machines. The gateway accepts connections only from the Oracle database.
A connection to the gateway is established through a database link when it is first used in an Oracle session. In this context, a connection refers to the connection between the Oracle database and the gateway. The connection remains established until the Oracle session ends. Another session or user can access the same database link and get a distinct connection to the gateway and Sybase database.
Database links are active for the duration of a gateway session. If you want to close a database link during a session, you can do so with the ALTER SESSION statement.
To access the Sybase server, you must create a <font style="background-color: #FFFFCC">database link</font>. A public database link is the most common of database links.
SQL> CREATE PUBLIC DATABASE LINK dblink CONNECT TO
2 "user" IDENTIFIED BY "password" USING 'tns_name_entry';
--dblink is the complete database link name.
--tns_name_entry specifies the Oracle Net connect descriptor specified in the tnsnames.ora file that identifies the gatewayAfter the database link is created you can verify the connection to the Sybase database, as follows:
SQL> SELECT * FROM DUAL@dblink;
Configuring Oracle Database Gateway for Sybase
<font style="background-color: #FFFFCC">{message:id=10649126}</font> -
Fetch the data from the tables in the SQL 2005 server to sap R/3.
Hi Experts,
We need to fetch the data from the tables in the SQL 2005 server to sap R/3.
Please explain which will be the best approach to fetch the same and how to do it. Sample program can greatly help.
<< Please do not offer points >>
Regards,
Shobana K
Edited by: Rob Burbank on Sep 21, 2010 2:36 PMHi,
Try NATIVE SQL statements in your abap code otherwise you can try to establish jdbc connection from ABAP program.
search in SDN for samples!
Suresh -
How to determine the number of rows to be displayed in a report
hello experts,
Has anyone ever come across this requirement before? Before a report finishes being executed and before it displays the results, is there a way to determine the number of rows to be displayed as the result?
Many thanks in advance.
Regards,
InmaHello Arun,
Thanks for your reply but do you know which method I should use for this purpose if I use the table interface?
Thanks,
Inma -
How to determine cursorline in table control
Hi,
Every time an entry is inserted in the table control i need to put the cursorline in the next line.
It is ok while you are using the initial lines of the table control but when you use the scroll it is gone.
The complet scenario is:
- my table control is created with 5 lines.
- Every time the user inserts a line, a new line is created (so you will have always 5 lines behind to complete)
- when the 5th line is inserted, if you want to fill the 6tn you have to use the scroll
- In this moment is when i dont know how to determine the cursorline. It will be different depending how much de the scroll is moved. Maybe the correct cursorline is 5, or 3 or 2... Do you know how i can determine it? Is it possible?
Maybe the way would be to move the table control (scroll) one position and always cursorline would be 5, but i dont know if it possible neither.
Thank you,
ManelSorry misunderstood the question.
You will have to use the variable topline from the tablecontrol.
Edited by: Pedro Guarita on Feb 10, 2010 5:25 PM -
[JS CS3] How to determine if a table is threaded
I'm trying to figure out how to determine if a selected table flows from one threaded text frame to the next.
Given a table "myTable", I know that myTable.parent is a textFrame.
I know that myTable.parent.nextTextFrame and myTable.parent.previousTextFrame will give me the next/previous linked text frames, but how can I determine if the table flows into the next frame or not?
Thanks,
~ Keithtable.cells[0].insertionPoints[0].parentTextFrames[0] gives you the
text frame of the first cell
table.cells[-1].insertionPoints[0].parentTextFrames[0] gives you the
text frame of the last cell
If they are different, the table flows into another text frame...
Harbs -
How to make a whole table row be read at once?
Hi,
I want to make a whole table row be read at once by screenreaders if the table is not editable?
I tried to use "getAccessibleSelection" and return a own implementation which returns the number of columns at "getAccessibleSelectionCount".
But if "getAccessibleSelectionCount" return anything else than 1, the method "getAccessibleSelection" is never called.
Does anybody have a idea or a suggestion to solve this problem?
Thanks in advanceHi AJL,
If you mean a table of data values in the Data Portal, i.e. a list of channels, then yes you can do it. In that case you should just register load the channels you want to be read-only. You can do this interactively by right-clicking on the data file in question and select "Register data". You can also double-click on the file to select individual channels to load or register. Programmatically, this looks like
Call DataFileLoad(DataFilename, DataPluginName, ImportAction)
Setting ImportAction = "Register" will register load the channels. If dragging and dropping the data file loads it correctly, then you can set DataPluginName = "". Otherwise, you can specify there which DataPlugin to use for the import process.
You can also programmatically selectively load some of the channels from the data source:
Call DataFileLoadSel(DataFilename, FileImportFilter, ImportSelection, ImportAction)
The "ImportSelection" parameter works just like the CNo() function in DIAdem:
"GroupName/ChannelName"
"GroupName/[ChannelIndex]"
"[GroupIndex]/ChannelName"
"[GroupIndex]/[ChannelIndex]"
If, on the other hand, you mean a read-only table in the REPORT panel, your options are limited, though you can do that with a SUDialog.
Regards,
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
How to insert data in tables using loops sql
Oracle 10.2g
using Oracle sql*plus
Table student is
create table student(id)
as
select distinct student_id
from students_table;now
desc student; will retrieve
student
======
Name Null? Type
===========================
ID VARCHAR2(10)Now creating a sequence
create sequence st_seq;
alter table student add column no;
select * from student
no id
=========
234
298
This is the main part
There are 100 student id in the table
now i want to populate the table with sequences using seq.next_val
how to use a loop to insert 100 auto generated numbers in the table.
Thank you.
Expected result
Select * from student
no id
=========
1 234
2 298
.........Why i am doing this way instead of
create table student(no,id)
as
select st_se.nextval,student_id
from students;This will cause duplication of upn
using distinct would throw an error.
create table student(st_id,id)
as select distinct st_seq.nextval,academicyear
from student
as select distinct st_seq.nextval,academicyear
ERROR at line 2:
ORA-02287: sequence number not allowed hereThank you.Follow the example:
SQL> create table students_table (student_id number);
Table created.
SQL> insert into students_table values(10);
1 row created.
SQL> insert into students_table values(10);
1 row created.
SQL> insert into students_table values(20);
1 row created.
SQL> insert into students_table values(30);
1 row created.
SQL> insert into students_table values(40);
1 row created.
SQL>
SQL> commit;
Commit complete.
SQL> select *
2 from students_table;
STUDENT_ID
10
10
20
30
40
SQL> create sequence st_seq;
Sequence created.
SQL> create table student(no,id)
2 as
3 with distinct_table as
4 (
5 select distinct student_id
6 from students_table
7 order by student_id
8 )
9 select st_seq.nextval, student_id
10 from distinct_table
11 ;
Table created.
SQL> select *
2 from student;
NO ID
1 10
2 20
3 30
4 40
SQL>
Cheers,
Davide -
How to get rank within the row in SQL
I have an a key orderid and 4 other columns with orderdate&time in (16/12/2011 16:15:24 format) within a table.
the orderid has an average of 1million rows every week hence could not do this in excel for a 15 day period .
ORderid.........: mail........................................ : telephone ............................:online ........................................ store.......................... Agency
A3456...........15/12/2011 16:15:24 ............... 16/12/2011 14:12:01.............16/12/2011 16:14:00..........17/12/2011 11:22:55 ............12/12/2011 22:20:30
B678
C555
i want to create a new table which ranks each row according to the max orderdate and time say in another table
i want to capture the rank
KEY.......Mail............Tel............online.........store..........Agency
A3456.....4 ...............3...............2...............1............... 5
Is there any way either within the same table or in other table i wiould be able to get the rank based on the rows in SQL.
thnks
Edited by: UOOLK on 29-Dec-2011 06:46Something like this I think:
create new_order_table as
select order_id
,rank() over (order by mail desc) mail
,rank() over (order by telephone desc) telephone
,rank() over (order by online desc) online
,rank() over (order by store desc) store
,rank() over (order by agency desc) agency
from old_order_table;Assuming you want the most recent date to be ranked number 1. If you want number 1 to be the oldest then remove all the 'desc's from the order by clauses. -
How to execute procedure returning data rows from sql plus
Hi,
I want to execute a stored procedure that returns data rows from sql plus. please let me know the syntax for the same.
Thanks,
YGuser13065317 wrote:
Even if i get the result set into the cursor, do i have to do normal fetch into all the coumn variables within a loop
But suppose no of columns in my result set varies depending on a parameter to the stored procedure.
Is there any straightforward way to retrieve all the data irrespective of no of columns in the result set.There is no such thing as a "+result set+". Oracle does not create a temporary data set in memory that contains the results of your query. What would happen if this result set is a million rows and is too large to fit into memory? Or there are a 100 clients each with a 100,000 row result set?
This is not scalable. You will be severely limited in the number and sizes of these "+result sets+" that can be created in server memory.
A cursor is in fact a "program" that is created by compiling the SQL source code that you provide. This source code is parsed and compiled into what Oracle calls an execution plan. This is nothing but a series of instructions that the cursor will execute in order to return the rows required.
Thus the result set is actually the output from a cursor (a program). Likewise, bind variables are the input parameters to this program.
All SQLs are parsed and compiled as cursors and stored in the SQL Shared Pool. Oracle gives you handle in return to use to address this cursor - bind values to it, execute it, describe the output structure returned by the cursor, and fetch the output from the cursor.
On the client side, this handle is used in different ways. In PL/SQL alone, this cursor handle can be used as an implicit cursor (you do not even see or use the cursor handle in your PL/SQL code). Or you can use a PL/SQL cursor variable. Or a DBMS_SQL cursor variable. Or a reference cursor variable.
Why so many different client structures for the very same SQL cursor handle returned by Oracle? Because to allow you, the programmer, all kinds of different features and flexibility.
The ref cursor feature is the ability to pass this cursor handle around, not only between PL/SQL code, but also from PL/SQL to the actual client process (Java. VB, SQL*Plus, TOAD, etc).
The primary thing to remember - irrespective of what the client calls this (e.g. ref cursor, SQL statement handle, etc), this all refers to the same SQL cursor in the Shared Pool. And that this SQL cursor is a program that outputs data, and not a result set in itself. -
How to tune BW 3.5 on MS SQL 2005?
Hello,
I have installed BW 3.5 on MS SQL 2005 32 bit server but facing lot of performance issues. Server is going in hang stage as and when multiple reports are executed.
Pls suggest some parameters for enhancing the system performance.
SQL memory at database level is defined as 6 GB but in ST04 transaction its showing only 1.5:
Current Memory (MB) 1,563.1
SQL Memory Setting FIXED
Physical memeory is 16 GB---- where 8 GB is allocated for application and database is using 2 GB.
RZ10 parameters are *******************
rdisp/plugin_auto_logout 3600
icm/keep_alive_timeout -1
rdisp/max_comm_entries 2000
gw/max_overflow_size 25000000
gw/max_conn 2000
gw/cpic_timeout 60
rsdb/esm/max_objects 10000
rsdb/esm/buffersize_kb 40000
rsdb/obj/buffersize 40000
ztta/roll_extension 2000683008
abap/swap_reserve 20971520
abap/heaplimit 40894464
abap/heap_area_total 2000683008
abap/heap_area_nondia 2000683008
abap/heap_area_dia 2000683008
rdisp/ROLL_MAXFS 32768
rdisp/ROLL_SHM 32768
ztta/roll_area 2000896
ztta/roll_first 1024
abap/use_paging 0
install/codepage/appl_server 1100
zcsa/installed_languages ED
zcsa/system_language E
rsdb/ntab/sntabsize 3000
rsdb/ntab/irbdsize 6000
rsdb/ntab/ftabsize 30000
rsdb/ntab/entrycount 30000
rdisp/wp_ca_blk_no 300
rdisp/appc_ca_blk_no 100
zcsa/presentation_buffer_area 20000768
rsdb/cua/buffersize 5000
rtbb/buffer_length 30000
zcsa/table_buffer_area 50000896
rdisp/keepalive 0
rdisp/max_wprun_time 7200
zcsa/db_max_buftab 10000
rtbb/max_tables 1000
abap/fieldexit yes
rec/client ALL
zcsa/calendar_area 1000000
zcsa/calendar_ids 400
abap/buffersize 500000
login/no_automatic_user_sapstar 0
SAPSYSTEMNAME BPW
login/system_client 410
INSTANCE_NAME DVEBMGS01
SAPSYSTEM 01
rdisp/wp_no_dia 11
rdisp/wp_no_btc 5
rdisp/wp_no_vb 3
rdisp/wp_no_vb2 2
rdisp/wp_no_enq 1
rdisp/wp_no_spo 3
SAPGLOBALHOST ndelntx48
PHYS_MEMSIZE 6000
DIR_TRANS D:\usr\sap\trans
icm/server_port_0 PROT=HTTP,PORT=8001
DIR_ROLL D:\usr\sap\BPW\DVEBMGS01\data
DIR_PAGING D:\usr\sap\BPW\DVEBMGS01\data
DIR_DATA D:\usr\sap\BPW\DVEBMGS01\data
DIR_REORG D:\usr\sap\BPW\DVEBMGS01\data
DIR_TEMP .
DIR_SORTTMP D:\usr\sap\BPW\DVEBMGS01\data
rdisp/PG_SHM 16384
rdisp/PG_MAXFS 32768
em/initial_size_MB 6000
em/blocksize_KB 1024
em/stat_log_size_MB 20
em/stat_log_timeout 0
em/address_space_MB 512
PLEASE ADVISE to improve performance.
Regards,
Ankita.Hi,
the topic is much complicated.
First you have to understand if there is software or hardware bottleneck.
To do this you have to analyze many issue :
For example ST02 for memory parameter configuration and buffer swaps.
Then trought ST06 you can analyze if there is CPU , memory or I/O bottleneck.
How many saps have your server ?
How many users ?
How many dialog steps ?
Then you can analyze onlyne situation, for example when there is lot of workload go in SM50 and see what happen ( WP occupied and so on )
ST03 for workload analisies -
How to determine the number of rows of data in a datatable?
I have a datatable that I fill from an SQL query. I do not know exactly how many rows of data it will return (due to my selection criteria) but will be somewhere between 100 and 300 rows. I send this data into a report but need to determine the length of the report (panel height data member) programatically based on how much data the query has returned. So, I need a way to count how many rows are filled in the data table.
I tried doing a nested "if" statement checking the value of each cell but when I tested the expression at 59 "if" statements (will need 300+) I got a parser error in lookout when I tried to accept the connection. I also tried a type of loop by assigning cursor.2 either to its own value (circular) or to its own value plus one depending on the value of the cell at cursor.2. It was close but overshot by one row or more (much more sometimes).
Any clever ideas? Perhaps I have just been looking at this problem too long. Thanks, in advance, for your help.Since the datatable gets the data from the SQL query, you can also use the SQL statement to count the number of rows in the query result.
For example, in datatable you do "select localtime, trace1 from intdata where xxx". You can get the count by "select count(trace1) from intdata where xxx". Use the same condition in order to get the same number of rows.
Maybe another SQLExec object is needed to do the count.
Whenever the datatable executes the SQL, the SQLExec executes and return the count.
Ryan Shi
National Instruments -
How can i mark a Table Row in WebDynpro ?
Hi at all,
i have a problem in my WebDynpro View
In my WebDynpro-View there is a Table (Information about Invoice documents, around 50 lines) and the User can select all this rows by click with a mouse.
Another way for selecting rows is on the Top of the Table (left side) there is a Context-Menü, where the User can click by mouse "Select all rows". For this i have created a Action "onSelect" and can select all Elements from the Table.
But the main problem here is, that i cant "mark" the rows in the Table, the User can't see, that all rows is marked!
(Example "Screenshot" of my description is attached)
How can i solve this problem?
With best thanks
ErsinHi Ersin,
To select all records for processing in your WebDynpro table , the table node property Initialize Lead Selection drop down should be marked no. also Cardinality Property must be 0..N & Selection 0...N.
If multiple selections can be made in the Table, that is, if selectionMode = multi or multiNoLead, or ifselectionMode=auto and dataSource has selection cardinality 0..n or 1..n, the user can select or deselect rows using the menu. If the user chooses Select All , the lead selection stays. If no lead selection is set, no lead selection can be set when Select All is chosen. If user chooses Deselect All , the lead selection is deleted too.You can find an example in the system in component WDR_TEST_TABLE under Selection.
Best Regards
Priyesh Shah -
How do i keep my table row selected when i come back to the same page?
I have have the following issue.
I have a table with many rows. I select one row and click the button which takes me to another page. From that page when i click the back button which takes me back to previous page but the problem is that the row is no longer selected. How would i fix this problem?
Any idea, suggestion or sample code will be appreciated.
Thanks
NahmanHere you go..
1. To Get the selected Rows:
DATA: TV TYPE REF TO CL_HTMLB_TABLEVIEW,
LT_FORMS TYPE TIHTTPNVP,
TABLE_EVENT TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
tv ?= CL_HTMLB_MANAGER=>GET_DATA( request = request
name = 'tableView'
id = 'tvX' ).
IF tv IS NOT INITIAL.
table_event = tv->data.
clear selectedRowIndexTable.
selectedRowIndexTable = table_event->PREVSELECTEDROWINDEXTABLE.
if table_event->event_type eq CL_HTMLB_EVENT_TABLEVIEW=>CO_ROW_SELECTION.
read table selectedRowIndexTable with key table_line = table_event->ROW_INDEX
transporting no fields.
if sy-subrc eq 0.
delete selectedRowIndexTable index sy-tabix.
else.
field-symbols <i> type i.
append initial line to selectedRowIndexTable assigning <i>.
<i> = table_event->ROW_INDEX.
endif.
endif.
ENDIF.
ENDIF.
<b>Page attribute:</b>
selectedRowIndexTable TYPE INT4_TABLE
2. To store the selected row index into Server side cookie...
CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>SET_SERVER_COOKIE
EXPORTING
NAME = 'select_row'
APPLICATION_NAME = 'NONE'
APPLICATION_NAMESPACE = 'NONE'
USERNAME = SY-UNAME
SESSION_ID = 'NONE'
DATA_VALUE = selectedRowIndexTable
DATA_NAME = 'sbsp'
EXPIRY_TIME_REL = 3600.
3. Get the value from Server side cookie..
CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>GET_SERVER_COOKIE
EXPORTING
NAME = 'select_row'
APPLICATION_NAME = 'NONE'
APPLICATION_NAMESPACE = 'NONE'
USERNAME = SY-UNAME
SESSION_ID = 'NONE'
DATA_NAME = 'sbsp'
CHANGING
DATA_VALUE = selectedRowIndexTable.
Hope this will help you...
<b>* Reward each useful answer</b>
Raja T
Maybe you are looking for
-
Qosmio Laptop NOT REPAIRED!!
I was playing world of warcraft the last week of november and while I was playing - about 10 mins into the game, my Qosmio x500 just shuts off with no warning, nothing. I turned the laptop back on thinking it was just some kind of fluke or the batter
-
Installing Windows 7 OEM on Maverick
Apple Store advised me to get a Windows 7 OEM 64 bit disc for my 2013 macbook pro: http://www.amazon.com/Windows-Premium-System-Builder-Packaging/dp/B00H09BB16/ref =sr_1_1?s=software&ie=UTF8&qid=1393131478&sr=1-1&keywords=windows+7 . This is a gener
-
How to print the spool request with a given file name.
Dear Experts; I used FM RSPO_OUTPUT_SPOOL_REQUEST to print spool request. And the device type is a local pdf printer. By default, the download file name will be the spool id. How can I change the download file name? Thanks! Convert 'CutePrinter' to q
-
Hi all, I have an old G4. I want to make it my home media center. So I meed to connect it to my cable content provider in one hand and to my HDTV on the other. I want to record TV shows and movies as well as to save all my Audio and video content and
-
Mixed HTTP/HTTPS in one Struts-Application?
Hello! I need to mix SSL (HTTPS)-Connection for Login and a few admin-pages and "normal" HTTP-Connections for most of my pages in my Struts-bases Webapplication. How can i handle this issue? Where can i get a detailled description of configuration an