Output results in rows of 10?

Is there a way to do this when outputing query results?
Thanks

Look at tis tutorial:
http://tutorial310.easycfm.com/
Ken Ford

Similar Messages

  • Output results to more columns...

    Hi!
    I have problem, for which I didn't find solution yet.
    I have query and this query returns the unknown count of rows (this row count is unknown in time of developing). I would like output results of this query to more than one result column to the screen.
    Example:
    I would like output results like this:
    Result 1 Result 3 Result5
    Result 2 Result 4
    so the number of the rows is minimal!!!
    It can be called real down/across!
    (not like this:
    Result 1
    Result 2
    Result 3
    Result 4
    Does anybody know the generic solution, how to do?
    Thanks!
    null

    Place the data models as you want and design with additional frames
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by abcdefgh:
    Hi!
    I have problem, for which I didn't find solution yet.
    I have query and this query returns the unknown count of rows (this row count is unknown in time of developing). I would like output results of this query to more than one result column to the screen.
    Example:
    I would like output results like this:
    Result 1 Result 3 Result5
    Result 2 Result 4
    so the number of the rows is minimal!!!
    It can be called real down/across!
    (not like this:
    Result 1
    Result 2
    Result 3
    Result 4
    Does anybody know the generic solution, how to do?
    Thanks!<HR></BLOCKQUOTE>
    null

  • Displaying SQL Query results in rows instead of Columns

    Hi,
    I'm fairly new to Oracle so forgive me if this is a really stupid question.
    I used Mysql for a while and if I wanted to display query results in rows instead of columns I could end the SQL command with '\G' instead of a semicolon.
    This would give me output like...
    Column_1: AAAA
    Column_2: BBBB
    Column_3: CCCC
    Instead of the normal
    Column_1 Column_2 Column_3
    AAAAAA BBBBBBB CCCCCCC
    Is there an equivalent in SQLPlus to the MySQL \G termination?
    Thanks.
    John

    > so forgive me if this is a really stupid question.
    It is certainly not a stupid question, but pivoting is a very frequently asked and answered question:
    [url http://forums.oracle.com/forums/search.jspa?threadID=&q=pivot&objID=f75&dateRange=all&userID=&numResults=15]http://forums.oracle.com/forums/search.jspa?threadID=&q=pivot&objID=f75&dateRange=all&userID=&numResults=15
    In 11g you have special PIVOT and UNPIVOT functions.
    Regards,
    Rob.

  • How to call a SP with dynamic columns and output results into a .csv file via SSIS

    hi Folks, I have a challenging question here. I've created a SP called dbo.ResultsWithDynamicColumns and take one parameter of CONVERT(DATE,GETDATE()), the uniqueness of this SP is that the result does not have fixed columns as it's based on sales from previous
    days. For example, Previous day, customers have purchased 20 products but today , 30 products have been purchased.
    Right now, on SSMS, I am able to execute this SP when supplying  a parameter.  What I want to achieve here is to automate this process and send the result as a .csv file and SFTP to a server. 
    SFTP part is kinda easy as I can call WinSCP with proper script to handle it.  How to export the result of a dynamic SP to a .CSV file? 
    I've tried
    EXEC xp_cmdshell ' BCP " EXEC xxxx.[dbo].[ResultsWithDynamicColumns ]  @dateFrom = ''2014-01-21''"   queryout  "c:\path\xxxx.dat" -T -c'
    SSMS gives the following error as Error = [Microsoft][SQL Server Native Client 10.0]BCP host-files must contain at least one column
    any ideas?
    thanks
    Hui
    --Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

    Hey Jakub, thanks and I did see the #temp table issue in our 2008R2.  I finally figured it out in a different way... I manage to modify this dynamic SP to output results into
    a physical table. This table will be dropped and recreated everytime when SP gets executed... After that, I used a SSIS pkg to output this table
    to a file destination which is .csv.  
     The downside is that if this table structure ever gets changed, this SSIS pkg will fail or not fully reflecting the whole table. However, this won't happen often
    and I can live with that at this moment. 
    Thanks
    --Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

  • Adding field in standard SAP transaction output results.

    Hi,
    I have to add a new field in standard SAP transaction output results.
    Can any one tell me what are the ways (brief explanation) that I can do this?
    If using exists - then what kind of exists I have to use? And how to find out the possibility with user exists?
    Thanks for your time.
    Thanks.
    Chris.

    Hi,
        There are so many ways to find out the user exits.
    Hi,
    To see SAP Exits -> Use Tcode SMOD
    To See create a project for Customer Exits -> Use Tcode CMOD
    There are projects to which Exits are assigned. Selects the relevant projects.
    What is User Exit:
    http://www.sap-img.com/abap/what-is-user-exits.htm
    How to find then:
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    All Exits List:
    http://www.easymarketplace.de/userexit.php
    Do a search on SAP Exits, Customer Exits, enhancements, etc
    Step 1 :- Execute transaction
    step 2 :- Click on Status Menu
    step 3 :- Double click on the program (screen) __?????___
    Step 4 :- Search source code for the 'Customer-Function' string using the find button. Remember to select 'In main program'.
    Step 5 :- A list of search results should be displayed indicating where all function exits can be found.
    You can now double click on each of them to go to its position in the source code. This also
    allows for the insertion of breakpoints so that you can test if the exits are called in the
    appropriate place.
    Step 6 :-Once you have found the Function Exit within the source code (Find Function Exit) you need to
    access the actual function module it executes. This is done using the following steps:
    Step 6.1 :-
    Step 1
    Locate desired 'Call Customer-function' statement within source code.
    Step 2
    If code is not within main program (module pool) e.g. SAP* then you will need to find this
    out by selecting 'Main Program' from the 'GOTO' menu. The Main program for transaction
    Step 3
    The actual function module name can now be calculated based on the information retrieved,
    it is defined by the following format:
    EXIT_<Program name>_<Exit number>
    eg :- 'EXIT_SAPLMR1M_004'.
    Step 7.1:-
    Once you have found the Exit function module
    Step 1
    Execute transaction CMOD
    Step 2
    Select 'SAP Enhancements' from the 'Utilities' menu.
    Step 3
    Select 'All selections' from the 'Edit' menu.
    Step 4
    Now populate the Component name field with the exit function module and press
    the execute button.
    Step 5
    A list of all Exits(Enhancements) containing that function module should now be displayed.
    Step 5
    You can now double click on the desired exit to display a detailed description of its uses and a list of all
    components contained in it.
    Implementing Function Exit
    This is required in-order to activate Function exit:
    Step 1
    The first step is to enter source code into function module in the usual way i.e. via SE37.
    There will already be an include declaration within the code with the following
    format: Include zx*.
    Double click on this to create it, source code can then be entered within here.
    Although it is good practice to create another include with this to store your
    code, this allows separation of difference enhancements allowing them to be easlity
    removed without de-activating the enhancement.
    Step 2
    Execute transaction CMOD and create new Enhancement. Enter name and press the create
    Button.
    Step 3
    The following screen should be displayed, enter short text then click on the 'Enhancement
    Step 4
    Now enter the Exit name (enhancement) which contains the desired Function Exit.
    Step 5
    Return to initial screen of CMOD and press the activate icon. The exit is now ready for use.
    Please Mark The Helfull Answers & close the thread.
    regards
    dj
    reward for all useful answers.

  • Scheduled Excel/CSV output with 65k rows

    Hi Experts,
    I just wanted to confirm if in 3.1, can the scheduled excel/csv output handle >65 rows.  From what we've read, it is possible and we assumed that's thru manual run.  However, we aren't too sure if it is the same when scheduled.
    Kind Regards,
    Mark

    Hi,
    When the Webi excel output is > 65K rows, the 1st tab contains the 1st 65K rows and the rest goes to 2nd tab and forth and each tab has maximum 65K rows.
    However, there is a limitation on the total number of tabs can be created in a excel file during this conversion.  You will find out when you get there.
    Hope this helps,
    Jin-Chong

  • Output data in row wise instead of column

    hi all,
    i need to get the output data in row wise which is getting now as column wise.
    for eg:
    below is my final internal table.
    HEADING      DATE   MATNR   BUKRS   DMBTR
    jan/08        200801    567       10       800
    feb/08       200802    567       10       900
    mar/08      200803    567       10       200
    apr/09       200804    567       10       400 
    the output should come as
    MATNR  BUKRS   Jan/08   Feb/08   Mar/08   Apr/08
    567      10       800    900       200      400.
    instead of column wise the output should display as row as above.
    please help how to get this.
    thanks in advance

    Hi Vignesh,
    Please use below program which I created for you reference. It will work for your requirement.
    DATA:BEGIN OF it_test OCCURS 1,
         date(6),
         matnr(5),
         bukrs(3),
         END OF it_test.
    it_test-date = 'jan/08'.
    it_test-matnr = '01234'.
    it_test-bukrs = 'AE1'.
    APPEND it_test.
    it_test-date = 'feb8'.
    it_test-matnr = '56789'.
    it_test-bukrs = 'AE1'.
    APPEND it_test.
    it_test-date = 'mar8'.
    it_test-matnr = '23478'.
    it_test-bukrs = 'AE1'.
    APPEND it_test.
    START-OF-SELECTION.
      LOOP AT it_test.
        WRITE :/ 'DATE', 'MATNR', 'BUKRS', it_test-date, it_test-matnr,  it_test-bukrs .
      ENDLOOP.
    Output Will be as follows :-
    DATE MATNR BUKRS jan/08 01234 AE1
    DATE MATNR BUKRS feb8   56789 AE2
    DATE MATNR BUKRS mar8   23478 AE3
    Please set to resolve if this satisfies your requirement.
    Regards
    Abhii..

  • Query result Alternate row with different color   

    hello
    can anyone help me on a query result.
    i wish to have a :
    query result Alternate row with different color .
    ex.
    first row light grey
    second row darker grey.
    and repeats itself up to the last record/row.
    thanks

    <tr> <!------------------------------I replaced with
    <tr bgcolor="<cfif currentrow mod
    2>##D3D3D3<cfelse>##F5F5F5</cfif>">
    <td>
    #MYARRAY[x][2].CNO#
    </td>
    <td align="center">
    #MYARRAY[x][2].CDCDTt#
    </td>
    <td>
    #MYARRAY[x][2].PADESC#
    </td>
    <td align="center">
    #MYARRAY[x][2].INc#
    </td>
    <td align="center">
    #MYARRAY[x][2].Exp#
    </td>
    <cfset thirdArray = MYARRAY[x][3]>
    <cfif NOT arraylen(thirdArray)>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <cfelse>
    <cfloop index="z" from="1" to="3">
    <cfif z GT arraylen(thirdArray)>
    <td> </td>
    <td> </td>
    <cfelse>
    <td>
    #thirdArray[z][2]# 
    </td>
    <td>
    #thirdArray[z][3]# 
    </td>
    </cfif>
    </cfloop>
    <cfif arrayLen(thirdArray) gt 3>
    <td nowrap="nowrap">
    <cfloop index="z" from="4" to="#arraylen(thirdArray)#">
    #thirdArray[z][2]# - #thirdArray[z][3]#<BR />
    </cfloop>
    </td>
    </cfif>
    </cfif>
    </tr>
    I got this error.
    Variable CURRENTROW is undefined

  • WMI - Output result

    Hi 
    Am trying to fetch information from my client computers, that they have installed Skye or not  on there computers.
    I was able to write a WMI script,  works well, but the output result is written on cmd.
    How can i get the output result to excel or notepad..
    Please help me with the output script code.
    Here is my code 
    strComputer = "." 
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
    Set colItems = objWMIService.ExecQuery( _
       "SELECT * FROM Win32_Service where displayname like 'Skype%' ",,48) 
    For Each objItem in colItems 
       Wscript.Echo "Name: " & objItem.displayName
    Next
    Thanks
    Venky

    Hi 
    Iam trying to fetch information from my client computers, that they have installed Skye on there computers.
    I was able to write a WMI script,  works well, but the output result is written on cmd.
    How can i get the output result to excel or notepad..
    Please help me with the output script code.
    Here is my code 
    strComputer = "." 
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
    Set colItems = objWMIService.ExecQuery( _
       "SELECT * FROM Win32_Service where displayname like 'Skype%' ",,48) 
    For Each objItem in colItems 
       Wscript.Echo "Name: " & objItem.displayName
    Next
    Thanks
    Venky

  • Outputting Results in a single row from a Table

    Afternoon folks,
    I have a scenario in hand and I was hoping to get some pointers. I could write a PL/SQL program and all would be fine. I was hoping if there was a way to do it in SQL and not have to create a whole new sub-program for this. I already have a PL/SQL program that populates a table. I want to use that data now and output it in a certain manner.
    Any help is greatly appreciated and this is not something I need to solve by tonight. :)
    Script to create table and insert records into it:
    drop table FLIGHT_ROUTES;
      CREATE TABLE FLIGHT_ROUTES
       (FLIGHT_NO           VARCHAR2(7),
        ROUTE_ID            NUMBER,
        DAY_OF_OPERATION    NUMBER,
        ORIGIN              VARCHAR2(3),
        DESTINATION         VARCHAR2(3),
        STOPVER             VARCHAR2(3),
        ROUTE_TYPE          VARCHAR2(1)
    REM INSERTING into FLIGHT_ROUTES
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-1001',1,1,'SFO','LAX',null,'D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-1001',1,2,'SFO','LAX',null,'R');  -- Record 2
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,1,'SFO','JFK',null,'D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,2,'SFO','JFK','ORD','D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,3,'SFO','JFK','DEN','R');  -- Record 5
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,1,'LAX','JFK','YYZ','D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,2,'LAX','JFK','YYC','D');
    Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,3,'LAX','JFK','YUL','D');What I would like to do is output the results by Flight Number, Origin1, Destination1, Origin2, Destination 2 and Origin 3, Destination 3. The maxium number combinations per Flight is 3. The other condition is that the listing should only show the Origin and Destinations and Stopover if it's a Day time Flight. If its a Red Eye, then don't show that option. So, Record 2 would be completely omitted here as it's a Red Eye flight and Record 5 would be omitted for Origin/Destination/Stopover 3 for flight UX-2001.
    Flight_No       Origin1     Destination1    Stopover 1      Origin2          Destination2      Stopver2      Origin3    Destination3     Stopover3
    ============================================================================================================================================================
    UX-1001         SFO         LAX
    UX-2001         SFO         JFK                             SFO              JFK               ORD
    UX-3001         LAX         JFK             YYZ             LAX              JFK               YYC           LAX        JFK              YULEdited by: Roxyrollers on Sep 9, 2011 3:59 PM
    Edited by: Roxyrollers on Sep 9, 2011 3:59 PM
    Edited by: Roxyrollers on Sep 9, 2011 4:00 PM

    Hi,
    Assuming that day_of_operation is what determines whether a row is 1, 2 or 3:
    WITH     got_r_num     AS
         SELECT     f.*
         ,     ROW_NUMBER () OVER ( PARTITION BY  flight_no
                                   ORDER BY          day_of_operation
                           ) AS r_num
         FROM    flight_routes        f
         WHERE     route_type     != 'R'
    SELECT       flight_no                              || ',' ||
           MAX (CASE WHEN r_num = 1 THEN origin      END)     || ',' ||     -- Origin 1
           MAX (CASE WHEN r_num = 1 THEN destination END)     || ',' ||     -- Destination 1
           MAX (CASE WHEN r_num = 1 THEN stopver     END)     || ',' ||     -- Stopover 1
           MAX (CASE WHEN r_num = 2 THEN origin      END)     || ',' ||     -- Origin 2
           MAX (CASE WHEN r_num = 2 THEN destination END)     || ',' ||     -- Destination 2
           MAX (CASE WHEN r_num = 2 THEN stopver     END)     || ',' ||     -- Stopover 2
           MAX (CASE WHEN r_num = 3 THEN origin      END)     || ',' ||     -- Origin 3
           MAX (CASE WHEN r_num = 3 THEN destination END)     || ',' ||     -- Destination 3
           MAX (CASE WHEN r_num = 3 THEN stopver     END)  AS csv_text            -- Stopover 3
    FROM       got_r_num
    GROUP BY  flight_no
    ORDER BY  flight_no
    ;Output:
    CSV_TEXT
    UX-1001,SFO,LAX,,,,,,,
    UX-2001,SFO,JFK,,SFO,JFK,ORD,,,
    UX-3001,LAX,JFK,YYZ,LAX,JFK,YYC,LAX,JFK,YULThis does not assume that origin1 is always on the same row with day_of_operation=1. Origin1 will be from the row with the lowest day_of_operation, not counting red-eyes. Likewise, origin2 will be from the row with the 2nd lowest day_of_operation, whether that value is 2 or not.
    If your data is such that the row with day_of_operation=n will necessarily be the nth lowest one, not counting red-eyes, then you don't need the sub-query got_r_num; just use your real table (with the condition WHERE route_type != 'R'), and use day_of_operation where I used r_num. (This is what Solomon's solution, which I just saw, does.)
    Edited by: Frank Kulash on Sep 9, 2011 4:47 PM
    Edited by: Frank Kulash on Sep 9, 2011 4:53 PM

  • Please assist with modifying this script to read in a list of servers and output results to excel

    Hello,
    I have an excellent script written by Brian Wilhite to gather the last logged in user using Powershell.
    http://gallery.technet.microsoft.com/scriptcenter/Get-LastLogon-Determining-283f98ae/view/Discussions#content
    My Powershell Fu is stumbling to modify this script to the following requirements:
    Currently the script must be loaded first into Powershell, then it can be executed.  I would rather edit the script in my Powershell ISE, add the .txt file to the script itself that gives a list of the servers I need to scan.  Then when I
    press Run Script in my ISE it executes.
    I would also like to output the results of the file to excel (.xls or .csv will do).  Currently the results look as follows:
    Computer : SVR01
    User : WILHITE\BRIAN
    SID : S-1-5-21-012345678-0123456789-012345678-012345
    Time : 9/20/2012 1:07:58 PM
    CurrentlyLoggedOn : False
    I would prefer it shows up like so:
    Computer User SID Time Currently LoggedOn
    SVR01 WILHITE\BRIAN S-1xxx 9/20/2012 1:07:58 PM FalseSRV02 WILHITE\BRIAN S-2xxx 9/26/2014 10:00:00 AM True
    Any help you can provide would be greatly appreciated.  I'll add the full script to the end of this post.
    Thank you.
    Function Get-LastLogon
    <#
    .SYNOPSIS
    This function will list the last user logged on or logged in.
    .DESCRIPTION
    This function will list the last user logged on or logged in. It will detect if the user is currently logged on
    via WMI or the Registry, depending on what version of Windows is running on the target. There is some "guess" work
    to determine what Domain the user truly belongs to if run against Vista NON SP1 and below, since the function
    is using the profile name initially to detect the user name. It then compares the profile name and the Security
    Entries (ACE-SDDL) to see if they are equal to determine Domain and if the profile is loaded via the Registry.
    .PARAMETER ComputerName
    A single Computer or an array of computer names. The default is localhost ($env:COMPUTERNAME).
    .PARAMETER FilterSID
    Filters a single SID from the results. For use if there is a service account commonly used.
    .PARAMETER WQLFilter
    Default WQLFilter defined for the Win32_UserProfile query, it is best to leave this alone, unless you know what
    you are doing.
    Default Value = "NOT SID = 'S-1-5-18' AND NOT SID = 'S-1-5-19' AND NOT SID = 'S-1-5-20'"
    .EXAMPLE
    $Servers = Get-Content "C:\ServerList.txt"
    Get-LastLogon -ComputerName $Servers
    This example will return the last logon information from all the servers in the C:\ServerList.txt file.
    Computer : SVR01
    User : WILHITE\BRIAN
    SID : S-1-5-21-012345678-0123456789-012345678-012345
    Time : 9/20/2012 1:07:58 PM
    CurrentlyLoggedOn : False
    Computer : SVR02
    User : WILIHTE\BRIAN
    SID : S-1-5-21-012345678-0123456789-012345678-012345
    Time : 9/20/2012 12:46:48 PM
    CurrentlyLoggedOn : True
    .EXAMPLE
    Get-LastLogon -ComputerName svr01, svr02 -FilterSID S-1-5-21-012345678-0123456789-012345678-012345
    This example will return the last logon information from all the servers in the C:\ServerList.txt file.
    Computer : SVR01
    User : WILHITE\ADMIN
    SID : S-1-5-21-012345678-0123456789-012345678-543210
    Time : 9/20/2012 1:07:58 PM
    CurrentlyLoggedOn : False
    Computer : SVR02
    User : WILIHTE\ADMIN
    SID : S-1-5-21-012345678-0123456789-012345678-543210
    Time : 9/20/2012 12:46:48 PM
    CurrentlyLoggedOn : True
    .LINK
    http://msdn.microsoft.com/en-us/library/windows/desktop/ee886409(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/library/system.security.principal.securityidentifier.aspx
    .NOTES
    Author: Brian C. Wilhite
    Email: [email protected]
    Date: "09/20/2012"
    Updates: Added FilterSID Parameter
    Cleaned Up Code, defined fewer variables when creating PSObjects
    ToDo: Clean up the UserSID Translation, to continue even if the SID is local
    #>
    [CmdletBinding()]
    param(
    [Parameter(Position=0,ValueFromPipeline=$true)]
    [Alias("CN","Computer")]
    [String[]]$ComputerName="$env:COMPUTERNAME",
    [String]$FilterSID,
    [String]$WQLFilter="NOT SID = 'S-1-5-18' AND NOT SID = 'S-1-5-19' AND NOT SID = 'S-1-5-20'"
    Begin
    #Adjusting ErrorActionPreference to stop on all errors
    $TempErrAct = $ErrorActionPreference
    $ErrorActionPreference = "Stop"
    #Exclude Local System, Local Service & Network Service
    }#End Begin Script Block
    Process
    Foreach ($Computer in $ComputerName)
    $Computer = $Computer.ToUpper().Trim()
    Try
    #Querying Windows version to determine how to proceed.
    $Win32OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer
    $Build = $Win32OS.BuildNumber
    #Win32_UserProfile exist on Windows Vista and above
    If ($Build -ge 6001)
    If ($FilterSID)
    $WQLFilter = $WQLFilter + " AND NOT SID = `'$FilterSID`'"
    }#End If ($FilterSID)
    $Win32User = Get-WmiObject -Class Win32_UserProfile -Filter $WQLFilter -ComputerName $Computer
    $LastUser = $Win32User | Sort-Object -Property LastUseTime -Descending | Select-Object -First 1
    $Loaded = $LastUser.Loaded
    $Script:Time = ([WMI]'').ConvertToDateTime($LastUser.LastUseTime)
    #Convert SID to Account for friendly display
    $Script:UserSID = New-Object System.Security.Principal.SecurityIdentifier($LastUser.SID)
    $User = $Script:UserSID.Translate([System.Security.Principal.NTAccount])
    }#End If ($Build -ge 6001)
    If ($Build -le 6000)
    If ($Build -eq 2195)
    $SysDrv = $Win32OS.SystemDirectory.ToCharArray()[0] + ":"
    }#End If ($Build -eq 2195)
    Else
    $SysDrv = $Win32OS.SystemDrive
    }#End Else
    $SysDrv = $SysDrv.Replace(":","$")
    $Script:ProfLoc = "\\$Computer\$SysDrv\Documents and Settings"
    $Profiles = Get-ChildItem -Path $Script:ProfLoc
    $Script:NTUserDatLog = $Profiles | ForEach-Object -Process {$_.GetFiles("ntuser.dat.LOG")}
    #Function to grab last profile data, used for allowing -FilterSID to function properly.
    function GetLastProfData ($InstanceNumber)
    $Script:LastProf = ($Script:NTUserDatLog | Sort-Object -Property LastWriteTime -Descending)[$InstanceNumber]
    $Script:UserName = $Script:LastProf.DirectoryName.Replace("$Script:ProfLoc","").Trim("\").ToUpper()
    $Script:Time = $Script:LastProf.LastAccessTime
    #Getting the SID of the user from the file ACE to compare
    $Script:Sddl = $Script:LastProf.GetAccessControl().Sddl
    $Script:Sddl = $Script:Sddl.split("(") | Select-String -Pattern "[0-9]\)$" | Select-Object -First 1
    #Formatting SID, assuming the 6th entry will be the users SID.
    $Script:Sddl = $Script:Sddl.ToString().Split(";")[5].Trim(")")
    #Convert Account to SID to detect if profile is loaded via the remote registry
    $Script:TranSID = New-Object System.Security.Principal.NTAccount($Script:UserName)
    $Script:UserSID = $Script:TranSID.Translate([System.Security.Principal.SecurityIdentifier])
    }#End function GetLastProfData
    GetLastProfData -InstanceNumber 0
    #If the FilterSID equals the UserSID, rerun GetLastProfData and select the next instance
    If ($Script:UserSID -eq $FilterSID)
    GetLastProfData -InstanceNumber 1
    }#End If ($Script:UserSID -eq $FilterSID)
    #If the detected SID via Sddl matches the UserSID, then connect to the registry to detect currently loggedon.
    If ($Script:Sddl -eq $Script:UserSID)
    $Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"Users",$Computer)
    $Loaded = $Reg.GetSubKeyNames() -contains $Script:UserSID.Value
    #Convert SID to Account for friendly display
    $Script:UserSID = New-Object System.Security.Principal.SecurityIdentifier($Script:UserSID)
    $User = $Script:UserSID.Translate([System.Security.Principal.NTAccount])
    }#End If ($Script:Sddl -eq $Script:UserSID)
    Else
    $User = $Script:UserName
    $Loaded = "Unknown"
    }#End Else
    }#End If ($Build -le 6000)
    #Creating Custom PSObject For Output
    New-Object -TypeName PSObject -Property @{
    Computer=$Computer
    User=$User
    SID=$Script:UserSID
    Time=$Script:Time
    CurrentlyLoggedOn=$Loaded
    } | Select-Object Computer, User, SID, Time, CurrentlyLoggedOn
    }#End Try
    Catch
    If ($_.Exception.Message -Like "*Some or all identity references could not be translated*")
    Write-Warning "Unable to Translate $Script:UserSID, try filtering the SID `nby using the -FilterSID parameter."
    Write-Warning "It may be that $Script:UserSID is local to $Computer, Unable to translate remote SID"
    Else
    Write-Warning $_
    }#End Catch
    }#End Foreach ($Computer in $ComputerName)
    }#End Process
    End
    #Resetting ErrorActionPref
    $ErrorActionPreference = $TempErrAct
    }#End End
    }# End Function Get-LastLogon

     This should work:
    Get-LastLogon -Computername (Get-content .\Servers.txt) | Export-CSV .\Output.csv -NoTypeInformation
    I just tested it on my test domain and it did the trick.

  • SQL query Output  exceeds 65000 rows in excel

    Hi,
    I have a SQL file attached to my concurrent program. The query in the SQL file returns tab separated output that i need to email as a csv through the same SQL file.
    The issue I am facing is that the query returns about 157000 records but only 65536 are being displayed in the excel worksheet.
    How can I get all the records by accommodating them in multiple worksheets of the same excel file?
    Please help!
    I am using EBS 11i.
    Code I am using in SQL file:
    set pages 3000
    set lines 300
    set heading off
    set term off
    set feedback off
    set verify off
    set echo off
    set serverout off
    spool /tmp/TEST.csv
    select 'Header'
    from dual
    SELECT column1||CHR(9)||column2
    FROM staging_table
    spool off
    set lines 1000 pages 40 head off echo off veri off
    select 'cd /tmp; cat $XX_TOP/install/sql/disclaimer.txt > x.dat; cat '||'/tmp/TEST.csv'||' | uuencode '||'/tmp/TEST.csv'
    ||' > '||substr('/tmp/TEST.csv',1,length('/tmp/TEST.csv')-4)||'.dat >> x.dat'
    ||' ; mail -s ''' ||'&1'||''' '||'&2'||' < x.dat'
    ||' ; rm '||substr('/tmp/TEST.csv',1,length('/tmp/TEST.csv')-4)||'.dat'||' ;'
    from dual
    list
    spool /tmp/email.txt
    spool off
    host chmod 777 /tmp/email.txt
    host /tmp/email.txt
    Thanks
    Edited by: user10648285 on May 13, 2011 5:27 AM

    open a blank Excel (2007 version), go to Data tab, then from External Data click From Text, select the CSV file (That having more than 65k records), click import, then from "start import at row" select 65001 and click next button, select delimiter as Comma, click Next button and filaly finish.
    In this way you will have the data after 65k rows in excel. Now you can simply open that cvs file in excel then you will have first 65k records (remening part will be discarded).
    So now you have two excel files and you can paste it in two diff tab.
    Note - you can repeate this activity if you have more than 130000 records...

  • How to output results to a file?

    If there is no Debug capability, how to output test results to a file?  Are there any other ways to do this?
    Thanks!

    Dear Sapport,
    You can use the IWDMessageManger to print the message on the webdynpro application iview screen.
    Please refer to the more details for the Webdynpro Logging and Tracing to find the root cause:-
    [Logging in Web Dynpro (Java) - a guide and tutorial for beginners [Part 1]|Logging in Web Dynpro (Java) - a guide and tutorial for beginners [Part 1]]
    [http://wiki.sdn.sap.com/wiki/display/WDJava/LoggingandTracinginWebDynpro|http://wiki.sdn.sap.com/wiki/display/WDJava/LoggingandTracinginWebDynpro]
    Hope it will resolve your issue.
    Best Regards
    Arun Jaiswal
    Edited by: Arun Jaiswal on Mar 5, 2012 12:47 PM

  • Outputing results into MS Excel

    Hello all, I am writting an application which gets data from MS Access. Is there a way I can get the results from a query and output them into an Excel spreadsheet??? Thank you

    Hi,
    I agree. Why use excel to read an Access file? They are virtually one and the same thing. But you could implement the AbstractTableModel in java and create your own version of Excel. Much more fun.
    best kev

  • Scanning .txt file and outputting results?

    Greetings Everyone. My employer has charged me with a rather
    confusing task. Basically I need to scan a .txt file and retrieve
    some information from it. Here is a little background on the file
    itself.
    This is a feed file containing the information for employees
    such as name, department, employement status etc...Zeros are used
    in place of spaces in this file. What I am charged with is
    retrieving the employment status and name for every single person
    in the file (60,000+).
    I need to write a coldfusion script that can do the
    following.
    1. Scan a .txt file that is sent to me every night and look
    for the 99th character on each line of the .txt file
    2. If the 99th character is a 'T' I need to pull characters
    '10-50' (which contain the name for that person).
    3. Output the results of the scan to a coldfusion page
    displaying the individuals' names.
    If anyone out there can point me in the right direction I
    would be very grateful. I've been looking for websites on this
    topic but I have been unsucessful so far. Should I post this in the
    advanced section of the cf forums? Once again, thank you for any
    help you can give me.

    I guarantee you can do this! And it shouldnt be to hard so
    you can breath a sigh of relief... :)
    I would use <cffile action="read" file="filepath/name.txt"
    variable="fileContents">
    Then you should be able to do something like <cfset
    fileArray = ListToArray(fileContents, "#CHR(13)##CHR(10)#")>
    Now you have an array so you can loop through and try
    something like the following...
    <cfloop index="i" from="1" to="#ArrayLen(fileArray)#"
    step="1">
    <cfif fileArray
    NEQ "">
    <!--- Find 99th Char --->
    <cfset 99thchar = Mid(fileArray, 99, 1)>
    <cfif 99thchar EQ "T">
    <!--- Get Name --->
    <cfset empName = Mid(fileArray
    , 10, 40)>
    <!--- Change 0's to Spaces--->
    <cfset empName = Replace(empName, "0", "#CHR(32)#")>
    <cfoutput>#empName#</cfoutput><br />
    </cfif>
    </cfif>
    </cfloop>
    That should be close to what you could use... You may have to
    tweak it a bit... now if it is going though 60000+ records this may
    take a while...lol You might have to use the cfsetting tag to
    extend the normal request timeout..
    Hope this helps!

Maybe you are looking for

  • Rate change in Scheduling Agreement

    Dear Gurus, What is the method to change the rate specified in a scheduling agreement. I am receiving material regularly from a supplier, now the rates are changed. how to do this ? regards, Ashish

  • Use of  RFBIBL00 .,

    Hi All, Please let me know the use of program  RFBIBL00  .Is this can be used for Data conversion of GL Open Line items , Vendor Open Items, Customer  Open items. Please share the Useful Links . Please share advantage and disadvantage in Ecatt method

  • Problem in using UTL_FILE.FOPEN with filename containing accent characters

    select value from nls_database_parameters where parameter = 'NLS_CHARACTERSET'; VALUE AL32UTF8 declare l_output UTL_FILE.FILE_TYPE; filename varchar2(100) := 'Avenue des Champs-Élysées.txt'; begin l_output := UTL_FILE.FOPEN ('UPLOAD_DIR', filename, '

  • New computer vs card reader/USB ***Solved***

    I'm not too sure what forum I need to address this to. Not sure if it's an issue of bios, OS or hardware. It's very weird, wherever it belongs. I just built a new computer (see specs below) and I have a HP Officejet 6300 with a front USB port combine

  • Updating the Firmware?

    Can this be done on a Mac yet? Or is it still a pc only option.. As i'd love to update my external pioneer drive firmware.. Come to think of it, i'd love to update the internal one too.. But Matshita never seem to update the firmware :o( Regards Chip