Assist with my SQL Reporting Script

I have started writing a HTML SQL reporting script based off of Jeffrey Hicks tutorial
Here is my entire script:
###################START SCRIPT#####################################
#requires -version 3.0
#Create a SQL Server report of said SQL environment
[cmdletbinding()]
Param(
[string]$computername=$env:computername,
[string]$path="$env:temp\sqlrpt.htm"
#define an empty array to hold all of the HTML fragments
#the fragments will break apart each HTML section in the final output so that you can out whatever information you like
$fragments=@()
#save current location so I can set it back after importing SQL module
$curr = get-location
#import the SQL module
Import-Module SQLPS -DisableNameChecking
#change the location back
set-location $curr
#get uptime
Write-Verbose "Getting SQL Server uptime"
$starttime = Invoke-Sqlcmd -Query 'SELECT sqlserver_start_time AS StartTime FROM sys.dm_os_sys_info' -ServerInstance $computername -database master
$version = Invoke-Sqlcmd "Select @@version AS Version"
#create an object
$uptime = New-Object -TypeName PSObject -Property @{
 StartTime = $starttime.Item(0)
 Uptime = (Get-Date)-$starttime.Item(0)
 Version = $version.Item(0).replace("`n","|")
$tmp = $uptime | ConvertTo-HTML -fragment -AS List
#replace "|" place holder with <br>"
$fragments += $tmp.replace("|","<br>")
#SQL Host Information
$smo = new-object ('Microsoft.SqlServer.Management.Smo.Server') $computername
$fragments += "<h3>SQL Host Information Details</h3>"
$fragments += $smo | select ComputerNamePhysicalNetBios,Name, Processors, ProcessorUsage, PhysicalMemory, PhysicalMemoryUsageInKB, MasterDBPath, BackupDirectory | ConvertTo-HTML -Fragment
#Get Status of all SQL related Services
Write-Verbose "Querying services"
$services = Get-Service -DisplayName *SQL* -ComputerName $computername |
Select Name,Displayname,Status
$fragments += "<h3>SQL Services</h3>"
$fragments += $services | ConvertTo-HTML -Fragment
#get databases
#path to databases
Write-Verbose "Querying datases"
$dbpath = "SQLServer:\SQL\Localhost\default\databases"
$fragments += "<h3>Database Utilization</h3>"
$fragments += dir $dbpath | Select Name,Size,DataSpaceUsage,SpaceAvailable,
@{Name="PercentFree";Expression={ [math]::Round((($_.SpaceAvailable/1kb)/$_.size)*100,2) }} |
Sort PercentFree | ConvertTo-HTML -fragment
#get database backup information
# Create an SMO connection to the instance
$smo = new-object ('Microsoft.SqlServer.Management.Smo.Server') $computername
$dbbackups = $smo.Databases
$fragments += "<h3>Last Database Backup Information</h3>"
$fragments += $dbbackups | select Name,LastBackupDate, LastLogBackupDate | ConvertTo-HTML -Fragment
#Login & Service Account Information#SQL Host Information
$smo = new-object ('Microsoft.SqlServer.Management.Smo.Server') $computername
$fragments += "<h3>Login & Service Account Information</h3>"
$fragments += $smo | select ServiceAccount, Logins | ConvertTo-HTML -Fragment
#volume usage
Write-Verbose "Querying system volumes"
$data = Get-CimInstance win32_volume -filter "drivetype=3" -ComputerName $computername
$drives = foreach ($item in $data) {
    $prophash = [ordered]@{
    Drive = $item.DriveLetter
    Volume = $item.DeviceID
    Compressed = $item.Compressed
    SizeGB = $item.capacity/1GB -as [int]
    FreeGB = "{0:N4}" -f ($item.Freespace/1GB )
    PercentFree = [math]::Round((($item.Freespace/$item.capacity) * 100),2)
    #create a new object from the property hash
    New-Object PSObject -Property $prophash
[xml]$html = $drives | ConvertTo-Html -fragment
#check each row, skipping the TH header row
for ($i=1;$i -le $html.table.tr.count-1;$i++) {
  $class = $html.CreateAttribute("class")
  #check the value of the last column and assign a class to the row
  if (($html.table.tr[$i].td[-1] -as [int]) -le 25) {                                         
    $class.value = "danger" 
    $html.table.tr[$i].Attributes.Append($class) | Out-Null
  elseif (($html.table.tr[$i].td[-1] -as [int]) -le 35) {                                              
    $class.value = "warn"   
    $html.table.tr[$i].Attributes.Append($class) | Out-Null
$fragments += "<h3>Volume Utilization</h3>"
$fragments += $html.innerxml
#define the HTML style
Write-Verbose "preparing report"
$imagefile = "c:\scripts\db.png"
$ImageBits = [Convert]::ToBase64String((Get-Content $imagefile -Encoding Byte))
$ImageHTML = "<img src=data:image/png;base64,$($ImageBits) alt='db utilization'/>"
$head = @"
<style>
body { background-color:#FAFAFA;
       font-family:Arial;
       font-size:12pt; }
td, th { border:1px solid black;
         border-collapse:collapse; }
th { color:white;
     background-color:black; }
table, tr, td, th { padding: 2px; margin: 0px }
tr:nth-child(odd) {background-color: lightgray}
table { margin-left:50px; }
img
float:left;
margin: 0px 25px;
.danger {background-color: red}
.warn {background-color: yellow}
</style>
$imagehtml
<br><br><br>
<H2>SQL Server Report: $Computername</H2>
<br>
#create the HTML document
ConvertTo-HTML -Head $head -Body $fragments -PostContent "<i>report generated: $(Get-Date)</i>" |
Out-File -FilePath $path -Encoding ascii
Write-Verbose "Opening report"
Invoke-Item $path
######################END SCRIPT##################################
I have 2 questions for help in regards to the above script:
1)  For the Login and Service Account portion I can't get my output to show up properly.  Here is the snip from the script:
#Login & Service Account Information#SQL Host Information
$smo = new-object ('Microsoft.SqlServer.Management.Smo.Server') $computername
$fragments += "<h3>Login & Service Account Information</h3>"
$fragments += $smo | select ServiceAccount, Logins | ConvertTo-HTML -Fragment
Here is how the output shows for this portion:
ServiceAccount
Logins
domain\svcAcct
             Microsoft.SqlServer.Management.Smo.LoginCollection
I would like top have the login information show in the above table of the all the different logins.  When I run the script without HTML for that portion and just output to console it shows the login info as I would expect.
2)  The 2nd question is, how do I add a variable to the bottom of the script to email the report to said email address.  This is probably simple but can't get my head wrapped around this part.
Thanks all in advance!

Thanks AnnaWY, that resolved the portion on how to email the report.  I was also able to utilize the following code which does the same thing as well:
#Send an email with the contents of the report
$MailBody= Get-Content $path
$MailSubject= "SQL Server Report"
$SmtpClient = New-Object system.net.mail.smtpClient
$SmtpClient.host = "smtp.server.com"
$MailMessage = New-Object system.net.mail.mailmessage
$MailMessage.from = "[email protected]"
$MailMessage.To.add("[email protected]")
$MailMessage.Subject = $MailSubject
$MailMessage.IsBodyHtml = 1
$MailMessage.Body = $MailBody
$SmtpClient.Send($MailMessage)
I still have not been able to resolve the portion regarding the login/service account information not showing up in the table correctly.  For the time being I have removed it from the environment report and instead included it as a script of its own
in our Security Auditing process.

Similar Messages

  • Issue with the supshare Report Script Command

    Hi All,
    I have created a report script to extract the Level0 data for the members of the accounts dimension and It does work fine and the performance is also good. However I have a challenge here. The shared members are repeating and therefore I used “<supshare” command in order to avoid the repetition. It does work, however there is an issue here.
    For eg, I am trying to retrieve the data as below and they are level0 members. The NetExpense is a “Level0” member and also a “shared member”, However the original “Net Expense” comes under Level3 and since I have used <Supshare and asked to retrieve only Lev0 accounts it is therefore ignoring the “Net Expenses” for all the Dept and product intersections. Hope I am clear and not confused? Is there anything i could change or add to retrieve the correct data.
    Would anyone be able to help me on this issue.
    <supshare “Lev0 Accounts”
    Data Retrieval Ex : DeptA  NetExpense No Product  1200
    Thanks

    Thanks Glen. I tried the below link statement. This is an example. My accounts dimension has 8 childern (A to H) out of which 4 are level 0 members ("B"to "E") and the remaining have so many members underneath. The member"H" is where my confusion starts, it has 4 children (Ex 1,2,3,4) and all are shared members. Here i need not worry about children 2 and 3 since they have no data. Children 4 is a level 0 and a shared member, however the Children 4 main location is also located at Level 0. Therefore when i use supshare this appears only once. one problem is solved.
    Now coming to Children 1, this is a Level 0 for parent "H", however this is also a child of "A" and this by itself has levels underneath. So this Sup share is not allowing me to retrieve the data Child 1 though it is level 0 and since it is shared member.
    This case how do i modify the report in such a way i get all level 0 data of my accounts and suppress shared members. Hope i have not condused...
    <ROW (Accounts)
    {ROWREPEAT}
    <LINK(<DESCENDANT ("A", "Lev0,Accounts"))
    "B", "C", "D", "E"
    <LINK(<DESCENDANT ("F", "Lev0,Accounts"))
    <LINK(<DESCENDANT ("G", "Lev0,Accounts"))
    <LINK(<DESCENDANT ("H", "Lev0,Accounts"))

  • Issues with the SQL wrapper scripts created with the DB adapter

    Hi All,
    We have the wrapper sql scripts created with the DB adapter configurations which are being used to invoke the stored procedures.
    To give you a background on the wrapper sql scripts-The Adapter Configuration wizard generates a wrapper API when a PL/SQL API has arguments of data types, such as PL/SQL Boolean, PL/SQL Table, or PL/SQL Record.
    These two SQL files are saved in the same directory where the WSDL and XSD files are stored, and are available in the Project view.
    The issue we are facing now is that whenever the associated package or the procedure structure undergoes a change we see an error as given below:
    An unhandled exception has been thrown in the ESB system. The exception reported is: "org.collaxa.thirdparty.apache.wsif.WSIFException: esb:///ESB_Projects/Application1_ABC_ESB/DBADP_Update_Out.wsdl [ DBADP_Update_Out_ptt::DBADP_Update_Out(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'DBADP_Update_Out' failed due to: Error while trying to prepare and execute an API. An error occurred while preparing and executing the APPS.XXIRIS_SOA_R_WRAPPER.XXIRIS_AR_CUST_K$ API. Cause: java.sql.SQLException: ORA-04068: existing state of packages has been discarded ORA-04061: existing state of package body "APPS.XXIRIS_AR_CUST_K" has been invalidated ORA-04065: not executed, altered or dropped package body "APPS.XXIRIS_AR_CUST_K" ORA-06508: PL/SQL: could not find program unit being called: "APPS.XXIRIS_AR_CUST_K" ORA-06512: at "APPS.XXIRIS_SOA_R_WRAPPER", line 1 ORA-06512: at line 1 [Caused by: ORA-04068: existing state of packages has been discarded ORA-04061: existing state of package body
    In such cases we need to either execute the wrapper scripts again or refresh the connection pool in case the wrapper sql scripts for that procedure are not available.
    In some cases we see that the first instance errors out.However the second request and the subsequent requests after that goes through successfully.
    Please do let me know if anyone has faced such issues before.
    Any inputs in this regard would be of great help.
    Thanks in advance!
    Deepthi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I stumbled on a link in the oracle forum which says that the "create or replace package XXX" at the start of the PL/SQL procedure when run seems to intermittently cause the ORA-04068: existing state of packages has been discarded problem.
    As per the solution suggested an “alter package XXX compile" can be executed after the changes are made and then we would no longer get the error in BPEL/ESB and dont have to bounce the server too.
    __http://forums.oracle.com/forums/thread.jspa?threadID=185762_
    However the above solution does not seem to resolve the issue.
    Any help in this regard would be highly appreciated.
    Thanks,
    Deepthi

  • Assistance with an online report

    Hey everyone,
    I've developed a reporting application, but can't get the
    display to work. What I want it to do is display the results, based
    off the name (as it does now), but in ONE row. For example,
    currently "Connectivity" displays twice. Once for September, once
    for October. I want it to display once with September and October
    on the same line.
    How can I accomplish that?
    Thanks for any/all assistance you can provide!
    Here's what I've got right now:
    View
    Screenshot here

    Thanks for the responses so far. I'll try to clarify what I'm
    looking for.
    This is what I want it to do:
    Final
    Screenshot
    Note that the subjectIDName is never repeated, but the
    records (count, per month) are on one line.
    If I do a GROUP on the CFOUTPUT, then it displays one
    subjectidname, but does NOT move the second (or any after) to that
    same line.
    Any help is greatly appreciated.
    This is the full code, which displays current screenshot (see
    original post for link):
    <!---this displays everything of subject name for
    month--->
    <CFQUERY NAME="GetSubjects" DATASOURCE="#database#">
    SELECT DISTINCT SubjectIDName
    FROM Customers
    ORDER BY SubjectIDName
    </CFQUERY>
    <CFQUERY NAME="SubjectAndMonth"
    DATASOURCE="#database#">
    SELECT DISTINCT DatePart('m', CFDIncident_Date) AS DisplayMe,
    SubjectIDName, COUNT(*) AS Count2 FROM Customers
    GROUP BY SubjectIDName, DatePart('m', CFDIncident_Date)
    ORDER BY SubjectIDName, DatePart('m', CFDIncident_Date)
    </CFQUERY>
    <table width="75%" border="0" cellpadding="0"
    cellspacing="0">
    <TR>
    <TD
    align="left"><strong>NAME</strong></TD>
    <TD
    align="center"><strong>JAN</strong></TD>
    <TD
    align="center"><strong>FEB</strong></TD>
    <TD
    align="center"><strong>MAR</strong></TD>
    <TD
    align="center"><strong>APR</strong></TD>
    <TD
    align="center"><strong>MAY</strong></TD>
    <TD
    align="center"><strong>JUN</strong></TD>
    <TD
    align="center"><strong>JUL</strong></TD>
    <TD
    align="center"><strong>AUG</strong></TD>
    <TD
    align="center"><strong>SEP</strong></TD>
    <TD
    align="center"><strong>OCT</strong></TD>
    <TD
    align="center"><strong>NOV</strong></TD>
    <TD
    align="center"><strong>DEC</strong></TD>
    </tr>
    <CFOUTPUT QUERY="SubjectAndMonth">
    <TR bgcolor="###Iif(((CurrentRow MOD 2) is
    0),de('cccccc'),de('ffffff'))#">
    <TD align="center">#SubjectIDName#</TD>
    <CFLOOP INDEX="TestLoop" FROM="1" TO="12" STEP="1">
    <CFIF #TestLoop# IS #DisplayMe#>
    <TD align="center">#Count2#</TD>
    <CFELSE>
    <TD> </TD>
    </CFIF>
    </CFLOOP>
    </TR>
    </CFOUTPUT>
    </table>

  • Assistance with Sawmill Custom Reports

    After successfully implementing a pair of S650 WSAs, I am now being asked by our management for various reports.  I have produced a number of custom Sawmill reports which provide most of the information needed, but I am having trouble trying to produce one report.  The requirement is to show a breakdown of sites vsisited for each user, including the time spent, by month, such as in this example:
    Name
    Date
    Website
    Time spent
    Total per month
    Joe Bloggs
    1.3.10
    www.e-bay.co.uk
    1.30 hrs
    Joe Bloggs
    4.3.10
    www.First Choice.co.uk
    45 mins
    Joe Bloggs
    6.3.10.
    www.Boats4us.com
    25 mins
    2.40 hrs
    Paul Smith
    2.3.10
    www.Facebook.com
    3.45 hrs
    Paul Smith
    8.3.10
    www.gjw.co.uk
    25 mins
    Paul Smith
    9.3.10
    www.fashion.com
    4  mins
    Paul Smith
    12.3.10
    www.fashion .com
    2 mins
    5.15 hrs
    I have looked at using a Report Element of "Table with Sub-table" and, while this would work for sessions/hits, it won't show the time fields as these only appear to be available in the "Sessions" report elements.  Any help or advice on how to accomplish this task would be greatly appreicated.
    Regards,
    Kev

    Thanks for the advice Tim, I can now stop spending time trying to generate an impossible report.  I will just have to use the "Time by Server" report and filter it for a single user, although with over 600 people in our company, I will need to pick specific targets rather than produce reports covering everyone!
    Kev

  • Need Help with this SQL Report

    Declare @Total int
    Select
    @Total=count(*)
    From
    v_Add_Remove_Programs
    Where
    v_Add_Remove_Programs.DisplayName0 Like '@DisplayName'
    Select Distinct
    v_Add_Remove_Programs.DisplayName0 as [Software Product],
    Version0 as [Version],
    COUNT(v_GS_System.Name0) as [Count],
    Round(100.0*count(*)/@Total,1) as [Percentage]
    FROM
    v_Add_Remove_Programs
    Join
    v_GS_System ON v_Add_Remove_Programs.ResourceID = v_GS_System.ResourceID
    WHERE
    v_Add_Remove_Programs.DisplayName0 Like '@DisplayName'
    GROUP BY
    Version0,
    v_Add_Remove_Programs.DisplayName0
    ORDER BY
    [Percentage] DESC
    Select Distinct
    v_GS_SYSTEM.Name0 as [Computer Name],
    v_Add_Remove_Programs.DisplayName0 as [Software Product],
    Version0 as [Version]
    FROM
    v_Add_Remove_Programs
    Join
    v_GS_SYSTEM ON v_Add_Remove_Programs.ResourceID = v_GS_SYSTEM.ResourceID
    WHERE
    v_Add_Remove_Programs.DisplayName0 Like '@DisplayName'
    GROUP BY
    v_GS_SYSTEM.Name0,
    Version0,
    v_Add_Remove_Programs.DisplayName0
    ORDER BY
    [Version] DESC
    If I remove the @DisplyaName variables and type in a product name sucha as:
    = 'Microsoft Office Professional 2013" or something, it works fine. How can I get the @DisplayName variables to work for me?
    Thanks

    v_Add_Remove_Programs.DisplayName0 Like '%'+ @DisplayName+'%'

  • Creating a range with Substitution Variables for Report Script

    Is it possible to create a range with substituion varables for use in a report script. For example instead of listing "Jan" "Feb" "Mar" "Apr" in the report script can I use a sub varaible like Jan:Apr that will list them all out?

    while I have not had luck with ranges in report scripts, others have. You could have a substitution variable the is "Jun" "Jul " "Aug" or whatever you want the members to be. and it will replace jusr fine

  • SQL Report return No Data Found

    I have a page with a SQL Report that runs a very complex query. If the returns are that nothing is found, I want to run some JavaScript. How can I determine the count of the result set or the capture the exception? Or is there another way without rerunning the query?
    Thanks

    In Report Attributes tab, under Messages, you will see a section named "When No Data Found Message". In it, I added this javascript code. When no data was found, the javascript worked, and popped up a message box. You can replace the alert code below with a call to your javascript function.
    <script language="javascript">
    alert("no data found");
    </script>
    There is another way. In the Region Definition tab, there is a section called "Region Footer". In it, add this javascript:
    <script language="javascript">
    var i = #TOTAL_ROWS#;
    alert(i);
    </script>
    When variable i is zero, then you know that no data was returned.
    Hope this helps.
    Ravi

  • Remove Corrupted Sharepoint SQL Reporting Services

    Hi,
    I had my sharepoint 2013 foundation with sharepoint-SQL reporting services integrated removed from my server 2012. And I removed my sharepoint folders and regedit files for sharepoint manually to ensure complete uninstallation of sharepoint from my server.
    But now I did a reisntall of sharepoint and it works completely fine, but when I tried to install the reporting services again I cant as it says it is already installed but the service is not listed in my sharepoint Services list and when i tried removing
    the reporting service using the SQL installer from control panel it exits with an error
    Action required:
    Use the following information to resolve the error, and then, try to uninstall this feature again.
    Feature failure reason:
    An error occurred during the setup process of the feature.
    Error details:
    § Error installing SQL Server Reporting Services
    There was an error attempting to remove the configuration of the product which prevents any other action from occuring.  The current configuration of the product is being cancelled as a result.
    Error code: 25012
    Log file: C:\Program Files\Microsoft SQL Server\120\Setup Bootstrap\Log\20150220_144131\sql_rsshp_Cpu64_1.log
    Visit http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.2000.8&EvtType=sql_rsshp.msi%40Sqlmsirc_NotifyFeatureStates_64%4025012 to get help on troubleshooting.
    § Error installing SQL Server Reporting Services
    Install-SPRSServiceProxy : The term 'Install-SPRSServiceProxy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.At
    line:1 char:35+ & {$DebugPreference = 'Continue'; Install-SPRSServiceProxy -uninstall}+                                  
    ~~~~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : ObjectNotFound: (Install-SPRSServiceProxy:String) [], CommandNotFoundException    + FullyQualifiedErrorId : CommandNotFoundException
    Error code: 0x80131500
    Visit http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.2000.8&EvtType=0x6A1944E2%400xC68B78F0&EvtType=0x6A1944E2%400xC68B78F0 to get help on troubleshooting

    Install the sharepoint reporting services add-in to the exact same drive where you installed it before using the MSSQL installation file, now uninstall the add-in and the reporting service feature from the control panel. This will remove the corrupted
    files completely and now do a fresh installation

  • SQL Report Region

    Hi,
    I am using apex 4.0.1 and I have a page with several SQL Report regions. The user can edit the data in the report regions by clicking a column that uses a href link to open a DML page in a modal window. The user can then amend some data in the modal window, press save which closes the modal window and uses the partial page refresh process to refresh the SQL report region. (Using apex.event.trigger('#SOME_REGION'),'apexrefresh')).
    If I navigate through the report to show rows 31-45 and then click on a href to edit a record. On pressing save, the report is refreshed but the rows displayed goes back to 1-15.
    How can I get the report to stay showing the rows 31-45?
    Cheers
    Paul.

    I believe this answers my question
    http://monkeyonoracle.blogspot.com/2010/11/refresh-report-region-and-pagination.html
    Edited by: pjturley on Jan 10, 2012 1:14 PM

  • Add SQL reporting services to get Azure sql db data

    Dear all,
    I have read recently that SQL server reporting services as been remmoved from Azure services. I have a SQL server database on azure which collect different type of data which are collected from a web admin portal by my users.
    I have a strong need to bring to that admin web portal a flexible reporting solution for my users to monitor collected data.
    Of course I can bring dash board to web application but often it is painful to change web app when a user want different type of report.
    What could be the way now to use online reporting service in orde to bring online report for my user of my sql azure database ?
    regards
    serge

    Hi serge,
    Based on my understanding, you want to use SQL Azure database to design the report, right?
    As you mentioned,
    Azure SQL Reporting is officially discontinued, so that we can’t design reports with Azure SQL Reporting. However, only the Azure cloud implementation of SQL Reporting is discontinued. All other forms of Reporting Services technology are unaffected. In
    Reporting services, it’s supported connect to SQL Azure database. So in your scenario, you can connect to the SQL Azure database to design the report. For more information, please refer to this article:
    How to connect to SQL Azure using SQL Server Reporting Services 2008 R2.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Calling SQL Server Script File in Hypersonic DB

    HI All,
    I am using Hypersonic Database with java swing.
    To update the database, i am getting SQL Server script file through a webservice.
    The problem is i dont have any idea, how i can update Hypersonic Database with the SQL Server script file.
    Please Help.
    Thanks
    Nitin

    Also I think
    CREATE TABLE table1
    ( tableoneid INT PRIMARY KEY NOT NULL
    , name VARCHAR(255) NOT NULL
    , PRIMARY KEY(tableoneid) );should probably be
    CREATE TABLE table1
    ( tableoneid INT CONSTRAINT table1_pk PRIMARY KEY
    , name VARCHAR(255) NOT NULL );otherwise you specify the primary key twice (and PRIMARY KEY implies NOT NULL so the NOT NULL is redundant).
    Then TABLE2 might need to be something like:
    CREATE TABLE table2
    ( tabletwoid INT NOT NULL
    , tableoneid NOT NULL CONSTRAINT table2_table1_fk REFERENCES table1
    , CONSTRAINT table2_pk PRIMARY KEY(tabletwoid, tableoneid) );although the table-level constraint syntax could be used for the foreign keys if it meant less editing of your scripts. The "CONSTRAINT constraintname" clause of constraints is optional but recommended, as otherwise they will get system-generated names like "SYS_C005157". (Note that if you specify the FK inline as part of the column definition you do not need to include a datatype.)
    If the IDENTITY clause causes a sequential value to be assigned as a default, there is no direct equivalent to that in Oracle. The nearest thing would be a row-level BEFORE INSERT trigger.

  • Changing a SQL Report server Database to a new One Using Powershell script

    Hi,
    I have an existing report server (Native Mode) and a pre-configured report server database. I have created a new database and want to assign it new report server database. How can i automate this process using powershell?
    Here is the detail requirement
    If there is a Report Server database seeded on the xxxxx server, follow the below steps:
    ◾Click the Database button on the left. Click on the Change Database button, choose option Choose an existing report server database. Enter the RPT server name (e.g. xxxxxx) in Server Name text box and click Next.
    ◾In the Report Server Database selection, select the ReportServer database. Then click next button to complete the process.
    Any help in this regard will be very much helpfull.
    Sushruta Banerjee

    Hi Sushruta,
    To query export from Report server Database, the scripts below may be helpful for you:
    Export RDL Files from ReportServer Database with PowerShell
    SQL Database Reports with PowerShell
    I hope this helps.

  • MCTS 70-466 Implementing Data Models and Reports with Microsoft SQL Server 2012

    I am searching for training kit for Exam 70-466 (Implementing Data Models and Reports with Microsoft SQL Server 2012) but I think is not published yet. I was expecting its release in Jan or Feb 2014. Would any one can tell me its release date or any place
    where I can find this book.
    Thanks
     

    Hi Azhar lqbal Gondal,
    According to your description, since the issue regards training and certification,
     I suggest you post the question in the Learning forums at
    http://social.technet.microsoft.com/Forums/en-US/home?category=learning. It is appropriate and more experts will assist you. If you have a specific technical question about Microsoft SQL Server,
     you can visit and post your question on  the SQL Server Forum.
    There is some detail about Exam 70-466 Implementing Data Models and Reports with Microsoft SQL Server 2012, you can review the following articles.
    Exam content can be found here:
    http://www.microsoft.com/learning/en-us/exam-70-466.aspx
    http://borntolearn.mslearn.net/certification/database/w/wiki/525.466-implementing-data-models-and-reports-with-microsoft-sql-server-2012.aspx#fbid=Mn-t6aRhs-H
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • SQL Report with Scroll - javascript

    This is an example of Apex SQL Report with Scroll - made with javascript: http://tryapexnow.com/apex/f?p=12090:9
    Waiting for comments here.

    Yes, because of the page generated by APEX, if you use the Report Template APEX 4.0 Standard, the div created for the report table has the ID "with_scroll" but there is another div which actually contains the table, and it's ID is "report_with_scroll", they just add a "report_" in front of it.
    I find the table by searching through the childs of that div: var table = document.getElementById(myRegion).rows[1].cells[0].firstChild;
    You can use the first one, with the ID "with_scroll", but this code line will be longer.
    Also to addapt the script for other report templates, you just need to see the code generated by every template, and correct this line, to get the real table containing your report.

Maybe you are looking for

  • Error:the ipod cannot be updated. the disc could not be read from or writte

    May sound silly I am sorry, new to this. Just got an ipod shuffle and have gone through all troubleshooting suggestions ie: restore ipod, reinstall software etc. Am getting an error: "The ipod "administrator's ipod" cannot be updated. The disc could

  • Transferring photos in Photoshop 11

    Have just transferred photos from old to new computer. Photos transferred OK but folder names did not. It would save a lot of work if folder names could be transferred as well. Running Photoshop 11 and Windows 8.1 Any help would be appreciated

  • A table mapping between ISO country code and ISO currency code

    Hi experts, I want to know whether there is a table mapping between ISO country code and ISO currency code.I have searched T005(Countries) and TCURC(Currency Codes).why the filed of WAERS(Country currency) hasn't maintained in talbe T005?Whether ISO

  • How to see what processes are using my memory?

    I recently added more RAM to my system and I always keep Activity Monitor running with the memory usage icon on the Dock to see how much Lion and my programs use. I noticed that even several CS5 programs running at the same time won't use that much,

  • Support of CR XI by Microsoft

    Post Author: Andrew Olmsted CA Forum: General I've been told that MS SQL server does not support Crystal Reports XI past MS SQL 2003. Does anyone have any additional info on this?