Fastest way to check total number of rows from View ?

Hello Everyone,
Good Morning !!!!
I am trying to know the exact number of rows from a view.
I have total 262 columns in a view name vw_sample. First column name is col_1 and I do not have permission to view that. but I do have permission to view all other 261 columns. I want to know fastest way to know exact number of rows in this view vw_sample.
How can i know that ?
I tried below things.
1) Tried using COUNT(*) & COUNT(1) but I don't have permission to first column col_1 so that didn't worked.
2) I do not have permission to view DMV "sys.dm_db_partition_stats"
3) I tried to execute below code.
select col_2, col_3,...col_262
into #TempTable
from vw_sample
and it gave me below error
Msg 1105, Level 17, State 2, Line 1
Could not allocate space for object '<temporary system object: 9830433781072176840>'
in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
4) Accidentaly I run below code
select col_2, col_3,...col_262
from vw_sample
It gave me 11 million rows in 40 minutes. As we know this method is not good to test just number of rows from a view.
So what would be my option here ?
Thanks in advance.
Thanks
Fredyy

Fredy, did you try with other column names instead of col1?
SELECT COUNT(col2) FROM View
What difference does that make, than using your column 1.
Please mark as answer, if this has helped you solve the issue.
Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
IMO, sqlsaga's answer is the way to go, but you may need to make a minor change.  When you do COUNT(<some expression>), SQL counts the number of rows where <some expression> is not NULL.  So if col2 can be NULL you need to make a change
so you know what you are counting can't be NULL.  If there is some other column in the view that can't be NULL, just count it.  Otherwise just use the ISNULL function to convert NULL's to a value.  For example, do
Select COUNT(IsNull(col2, 0)) From vw_sample
Note the above assumes that col2 is a type that contains a number (int, numeric, float, etc).  If col2 is of a different type, then just replace the 0 in the above with any valid value of the same type as col2 (so '' for varchar, '19000101' for datetime,
etc).
Tom

Similar Messages

  • Total  number of rows fetched

    hi
    Is there any way to get total number of rows fetched along with
    result set in a single query
    jos

    Hi,
    You are referring to "Analytical Functions"
    COUNT(*) OVER ()the above one your are counting the number of records, with respect to logical parition window -as if you specify with it the over clause. it won't provide the information as required, with respect to the your first post.
    - Pavan Kumar N

  • Display the total number of rows for the report in OBIEE 11g

    Hi, In obiee 11g, the pagination will be 1-25. Is there any possiblity in obiee to show the total rows count next to pagination. Ex: if the result contains 120 rows. it should display after the pagination
    Records 1-25. Total of Records : 120
    Is there any way we can display the total number of rows for the report.
    Kindly help me.. Its very urgent requirement.
    MAny Thank in advacne

    Check this http://obiee100.blogspot.com/2011/07/display-total-number-of-records-in.html
    and
    http://docs.oracle.com/cd/E28280_01/bi.1111/e10544/appsql.htm#CHDCDIDA
    You have to go something like as suggested in previous link.
    Mark as correct/helpful

  • Total number of rows

    Is there anyway of getting the total number of rows in the database via JDBC on a MySQL database?

    thanks guys for your help but since my returned result set is huge anything that has to load the whole result set in memory is absolutely out of the question.
    For my situation what DrClap suggested works wonders. I use
    SELECT COUNT(*) FROM SomeTable
    and then
    count = rs.getInt(1);
    This way I get the total number of rows plus its really quick.
    Thanks DrClap

  • Count total number of rows present in the schema

    Count total number of rows present in the schema including table, sequence, view
    Desirable Output
    table          Sequence     Views
    1000          20          1000

    You mean You need to count the No of Tables, View and Sequence Present in the Schema ??
    Hi Some thing like this,
    SELECT a.view_cnt AS "View Count", b.tab_cnt AS "Table Count",
           c.seq_cnt AS "Sequence Count"
      FROM (SELECT COUNT (*) view_cnt
              FROM USER_VIEWS) a,
           (SELECT COUNT (*) tab_cnt
              FROM USER_TABLES) b,
           (SELECT COUNT (*) seq_cnt
              FROM USER_SEQUENCES) cWhich give you,
    View Count      Table Count      Sequence Count
           153              878                   32Thanks,
    Shankar
    Edited by: Shankar Viji on Aug 28, 2012 3:03 AM

  • Find Total Number of Rows in Database

    I am trying to find total number of rows in Database? Thanks in advance

    I'd come back to a question of "why". What possible reason could you have to want to know the number of rows in every table in the database?
    This seems like it is a request from someone non-technical where they're not sure exactly what they need to ask to get the information they want. I'm forseeing something along the lines of
    User: How many rows are in the database
    DBA: Ummm.... <<goes off and spends a lot of resources to count>>> ... 1 billion.
    User: Wow, that's a lot... How big are those rows...
    DBA: Hmmm... <<goes off and spends more time trying to find an average row size>>... 100 bytes
    User: <<Plugs numbers into Excel>>... OK, our database is 93 GB, so we need to order 100 GB of disk for our new environment.
    DBA: <<Months later, after 100 GB of disk has been budgeted, purchased, and delivered>> User, you didn't order enough disk for our disaster recovery environment.
    User: You said our database was only 93 GB!!
    DBA: 93 GB of data. Plus 100 GB of indexes, TEMP, UNDO, space for archived logs, ...
    When "odd" requests come down, it's generally the case that the person asking the question doesn't know what question they really want to ask because they don't have the domain knowledge to know how to ask the question. Walking over and asking them what they're hoping to accomplish/ what they're using the data for generally leads to a case where
    - The user gets exactly the information they need, not the information they think they want
    - The DBA does a lot less work, since the right question is almost always easier to answer
    - The user thinks of the DBA as a really helpful sort of guy and remembers how helpful you were in the past when you have to push back on other things later
    - No one ends up playing the blame game when the user gets just what they asked for and not what they want.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to set total number of rows of table control

    Hi All,
    I want to set the total number of rows of table control. I don't want to display the blank rows in table.
    Regards,
    Shrinivas

    Need some fine tuning regarding the scrollbar height but it's a start
    Unless this isn't what you asked for
    Small number of rows
    Large number of rows
    Attachments:
    PlayingWithTable.vi ‏17 KB

  • Resukt:Get number of rows from 3 different table...?

    Hi All,
    I need to find out number of rows from 3 different table for the same conditions. Instead of writing 3 queries, is it possible to get it thru one query?
    For example, i need to find out number of rows in tables where name = 'Ameet' from 3 different table, i will end writing 3 queries.
    1. select count(1) from table_a where name = 'Ameet';
    1. select count(1) from table_b where name = 'Ameet';
    1. select count(1) from table_c where name = 'Ameet';
    Is it possible to write a single query to get result of all above 3 queries?
    result:
    table_a table_b table_c
    34 44 2

    One way:
    SELECT      (SELECT     COUNT(*) AS CNT FROM TABLE_A WHERE name='Ameet') AS TABLE_A
    ,     (SELECT     COUNT(*) AS CNT FROM TABLE_B WHERE name='Ameet') AS TABLE_B
    ,     (SELECT     COUNT(*) AS CNT FROM TABLE_C WHERE name='Ameet') AS TABLE_C
    FROM DUALIf you want the total:
    SELECT     SUM(CNT)
    FROM
         SELECT     COUNT(*) AS CNT FROM TABLE_A WHERE name='Ameet'
         UNION ALL
         SELECT     COUNT(*) FROM TABLE_B WHERE name='Ameet'
         UNION ALL
         SELECT     COUNT(*) FROM TABLE_C WHERE name='Ameet'
    )

  • How to get total number of pages from .doc file without using Office interop?

    Hi,
    Kindly help me in getting the total number of pages from a .doc file not .docx file using C#. I know how to get by using Office interop but I do not want to use Office interop.
    So, without office automation in C# let me know how to get the total number of pages from a .doc file.
    Regards,
    Ashok

    Hi Ashok,
    >> I know how to get by using Office interop but I do not want to use Office interop
    Could you tell us why you don't want to use Office interop?
    As far as I know, this is the easiest way to achieve.Hmmm,this is my answer
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.pagenumbers.startingnumber(v=office.14).aspx
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Determine number of rows from javascript so I can hide if zero

    Hi All,
    Found a great article which I adapted to use the link on a report to delete a row in db and remove from table (without a refresh).
    It works great except I want the region to not display when there are no rows left.
    Currently it shows "No Data Found" but because the page does not submit the region does not hide.
    Here is the Java code:
    function ackMsg(p_this, p_empno) {
    // get the table row on which the user clicked
    var tr = $(p_this).closest('tr');
    // perform an asynchronous HTTP AJAX request using jQuery
    $.ajax({
    type: "POST",
    url: "wwv_flow.show",
    data: {
    p_flow_id: $('#pFlowId').val(),
    p_flow_step_id: $('#pFlowStepId').val(),
    p_instance: $('#pInstance').val(),
    x01: p_empno, // assign p_empno to the g_x01 global variable
    p_request: "APPLICATION_PROCESS=ack_message" // refer to the application process
    beforeSend: // executes while the AJAX call is being processed
    function() {
    // delete following HTML classes from the table row element
    // could be possibly theme dependent
    tr.removeClass('even');
    tr.removeClass('odd');
    // use jQuery's animate function to give the table row, and its children, a red background
    tr.children().hover(function() {
    tr.children().animate({'backgroundColor': '#00cc00'}, 300);
    }, function() {
    tr.children().animate({'backgroundColor': '#00cc00'}, 300);
    tr.children().animate({'backgroundColor': '#00cc00'}, 300);
    success: // to be called if the request succeeds
    function() {
    jQuery(p_this).trigger('apexrefresh');
    // jQuery has difficulties animating inline elements
    // that's why we wrap them in a div, which is a block element
    tr.children().wrapInner('<div>').children().fadeOut(400, function() {
    tr.remove(); // visually remove the row from the report
    I did some Googling to add the line ' jQuery(p_this).trigger('apexrefresh');' which refreshes just that report.
    What I think I need to do is add a check for number of rows left after the refresh then if = 0 do full page refresh to allow the region condition to hide it.
    Unfortunately after hours on Google I can't find how to check how many rows are in the table.
    PS the function is called from the link in the report like this onclick="ackMsg(this, #ACK#)"
    Please help
    AT
    Edited by: user1678248 on May 13, 2013 9:39 PM
    Edited by: user1678248 on May 13, 2013 9:40 PM

    1)
    When you set a column to hidden in a classic report using the method I described, it creates hidden form elements for that column.
    <tt><input type="hidden" name="f01" value="" id="f01_0002"></tt>
    You should inspect the source to figure out the name value.
    Since this belongs to the wwv_flow form, we can therefore get this data with: wwv_flow.f01
    Alternatively, you could have used the apex_item API to achieve the same result, which probably gives a bit better control.
    http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_item.htm#CHDBFHGA
    select apex_item.hidden(1, col) || col col
    from table
    Set that column to a standard report column so it doesn't escape the html.
    You can also reference the data in these fields using PL/SQL using the apex_application API:
    http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_app.htm#CHDGJBAB
    2)
    As above, setting the column to hidden creates hidden elements on the page. It is simply f01 because that is the only hidden field I would have on my page. With four reports on the page, you would need to be careful not to do the same on the other reports, as you would get inaccurate data. For each report, setting columns to hidden always starts with f01. In that, you would be best to use the apex_item API.
    I actually initially ran into this issue when i had a tabular form on the same page as a report with hidden fields, which was causing conflicts in the page processes.
    Hope it helps.

  • Is there a way to check what I had purchased from the itune store to match the charges on my credit card, because there is a charge that I do not recognize

    Is there a way to check what I had purchased from the itune store to match the charges on my credit card, because there is a charge that I do not recognize

    http://support.apple.com/kb/HT2727
    Regards.

  • How to get first row from View Object cache.

    hi,
    I am using Jdeveloper 11.1.1.6
    can we get first row from View Object cache??
    Thanks in Advance.
    Best
    Shashidhar

    Hi Frank,
    Thanks for reply!!
    My case is:
    I have a Query based ViewObject.
    One of the field is LOV and remaining fields are in ADF table. the LOV field is out side ADF table when i insert first record in ADF table and i choose LOV  filed the value is selected.
    when i create second row LOV value got refreshed because both are in same VO.
    I need to get the LOV value of first row and set same value to second Row.
    Shashidhar

  • How do I increase the total number of rows?

    This seems like a dumb question, but I can only seem to be able to add one new row at the bottom of my spreadsheet at a time using the '=' in a circle button that appears below the last row of the spreadsheet.
    I want to add hundreds of rows, and I can only seem to add one at a time which seems ridiculous and a huge waste of time.  There has to be a way to add a huge block of empty rows to the spreadsheet right?  Can you really only add one new blank row at a time?

    you can select rows, then use the key combination <option> + <down arrow> to add the same number of rows you selected for each key press.
    If you select five rows then each time you type the key combination Numbers will add five rows.
    If I want to add many rows I select all rows, then type the key combination, then I select all rows, and type the key combination again, repeat as needed

  • How to check the number of rows in a table with input data?`

    Dear all,
    I am having a table ( with declaration of 5 rows during the init ) there's a next button which will add another 5 rows by pressing. Let say the user ony key in 7 rows of data.. how should i track it? coz these data act as input to my bapi function. One of the input field of my bapi is to state how many rows of data that a user had key in. Thank you.

    I think ur problem is empty records, u dont want to process empty table rows.
    m I right?
    if yes then just before processing the data / records, check for empty records and remove unwanted rows from the node.
    for (int i = 0; i < TableNode.size(); i++)
             if all cells of row(i) are empty
                   remove row(i) from Table Node.
    OR if you dont want to remove empty rows from display (screen), then at the time of processing, transfer useful rows to a separate node and process that node.
    Best Regards
    Deepak

  • What's the best/fastest way to check for existance of a userobject

    We are developing an Addon in VB.NET.
    I think there are two ways to check if a table exists:
    1) usertableMD.GetByKey(tablename)
    2) orecordset.DoQuery("SELECT * FROM sysobjects WHERE ...)
    I would like to use the first way, but is the GetByKey fast and how much will the call "System.Runtime.InteropServices.Marshal.ReleaseComObject(usertableMD) " slow down ?

    I personnaly use GetByKey
    I think that opening a recordset is not the optimized SAP solution, and anyway, you'll have to release the recordset
    Private Function UserTableExists(pst_TableName) As Boolean
        Dim dsa_UserTablesMD As UserTablesMD
        Dim dbo_ReturnCode As Boolean
        dsa_UserTablesMD = msa_Company.GetBusinessObject(BoObjectTypes.oUserTables)
        dbo_ReturnCode = dsa_UserTablesMD.GetByKey(pst_TableName)
        System.Runtime.InteropServices.Marshal.ReleaseComObject(dsa_UserTablesMD)
        Return dbo_ReturnCode
    End Function

Maybe you are looking for