Excel not opening files

About a month ago, Excel has had trouble opening native files.  I could double click an XLSX file and Excel would start only to tell me the file I was trying to open (and just used to launch Excel with) didn’t exists.

The following (in a cmd window) seems to have fixed it:

 

"C:\Program Files\Microsoft Office\Office\Excel.exe" /Regserver

 

Categories: Excel, MS Office

How to determine the current database context in SQL Server

I like to run a check script I’ve crafted that tells me stats on the database before I upgrade and perform schema changes.  To make the script more universal, I wanted it to report the name of the database the stats are for (for printing purposes). I knew how to check the database server hostname (IF @@SERVERNAME = ‘[expected hostname]‘ … ) but I couldn’t find how to check the database context on that server. 

I found my answer: db_name()

Now I can check server name and database context before running code changes:

IF db_name() != N’[database]‘ BEGIN …

Categories: SQL Server, SQL Server 2005, SQL Server 2008

How to change the path/move a project in Visual Studio

  • Close the solution.
  • Rename the folders outside Visual Studio.
  • Open the solution, ignoring the warnings.
  • Go through all unavailable projects.
    • Set the property ‘File Path’ to the new location.
    • Reload the project.
    • In case you didn’t rename the project, rename it (F2).
  • Taken from here: http://stackoverflow.com/questions/211241/how-do-i-rename-a-project-folder-from-within-visual-studio

    Categories: Visual Studio

    SSRS: Could not load type ‘Microsoft.ReportingServices.UI.GlobalApp’

    I suspect some MS patch caused this as no one has touched this server in months yet today, we got the following:

     

    Server Error in ‘/Reports’ Application.


    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not load type ‘Microsoft.ReportingServices.UI.GlobalApp’.

    Source Error:

    Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="Microsoft.ReportingServices.UI.GlobalApp" %>
    

    Source File: d:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportManager\global.asax    Line: 1


    Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407

    The solution is presented in the error message. Notice the bottom line in the error message: ‘Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407 ‘ – This should be running .NET 2 so we change the mapping for the applicaiton, /Reports and /ReportServer virtual folders to use V2 of .NET again (right click > properties > ASP.NET tab).

     

    Categories: SQL Server Reporting Services

    Database diagrams on disconnected devices

    If you try to use the database diagram feature in SQL Server Management Studio and the owner of the database is a domain id but you are disconnected from the domain (notebook users!), you’ll get an error like this:

    Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.

    What you need to do is change ownership of the database:

     

     

     

    /* replace the database name parameters with [CTRL]+[SHIFT]+[M] */

    use master

    go

    ALTER AUTHORIZATION ON DATABASE::<Database_Name, sysname, Database_Name> TO “sa”

    go

    use <Database_Name, sysname, Database_Name>

    go

    EXECUTE AS USER = N’dbo’ REVERT

    go

     

     

    Categories: SQL Server Management Studio

    Securing a single file with IIS7

    With IIS7's revamped interface, I had a hard time locating how to change the permission on a single file. I could see how to do so at a folder level, but I couldn't see how to do so on a single file (.CFM in this case).

     It turns out, once you hilghted the file you want to change the permission on, you right click and select 'Switch to Features View' – this changes to the features view on that one, single file.  Then you can use the Authentication module to set it up the way you want. You can tell you are changing one file by looking at the breadcrum trail in your address bar.

    Categories: Vista, Windows Server 2008

    8.3 Short filenames on Windows 2003 Server

    If you have a document repository of sorts, it may pay to disable short filenames (legacy leftover from Win95 days).

    To check if enabled:

    fsutil.exe behavior query disable8dot3

    To disable:

    fsutil.exe behavior set disable8dot3 1

    This will not remove existing short filenames but the system will no longer generate them.  This also works on XP.

     

    Categories: Windows Server 2003, Windows XP

    Powershell + 7zip + SQL Server backups

    I needed a way to shrink the backups in SQL Server 2005 (native compression doesn’t exist until the 2008 version). 7zip compresses better than most anything, it’s free (even for commercial use), its stable, and it’s small. Powershell is my favorite tool builder. This is the result:

    #set alias to 7zip - adjust path as necessary
    set-alias sevenZip "c:\program files\7-zip\7z.exe"
    
    #list of database filenames
    $dbdirectories = "db1","db2","db3","db4"
    
    $dbbackupDrive = "x:\"                              # this is where SQL Server stores its backups
    $dbzdestination = "y:\7zipped_backups\"             # this is where we will store the 7z version
    
    #Backups location
    cd "$dbzdestination"                                # change directory 
    
    #create some file masks based on date
    
    $ybu = get-date (Get-Date).addDays(-1) -format "yyyyMMdd"    # this is the filename mask of yesterday's backups
    $yz = get-date (Get-Date).addDays(-1) -format "yyyy.MM.dd"   # this is the filename mask of the zip destination
    $yzr = get-date (Get-Date).addDays(-2) -format "yyyy.MM.dd"  # these are the day old 7zips (unused yet)
                                                                 # I may want to remove older 7zips after copied offsite
    
    #$exclude1 = "-x!*.dif"                             # unused but could be appended to command
    #$exclude2 = "-x!*.7z"                              # unused but could be appended to command 
    
    foreach ($dbdirectory in $dbdirectories)            # looping each db name in our list,
    {  
    
        $backuppath = $dbbackupDrive + $dbdirectory + "\"            #build the path to the backup sources
        $backupfiles = $dbdirectory + "_backup_" + $ybu + "*.*"       #build the filename mask
        $input = $backuppath + $backupfiles                          #full path to source files (SQL Server's files)
    
        $outputfile = $dbdirectory + "_backup_" + $yz + ".7z"        #build the 7z filename (7zip file)
    
        cd "$dbzdestination$dbdirectory"               #change the path to the backup destination
    
        # command line switch descriptions (see http://dotnetperls.com/7-zip-examples)
        #   -t7z = 7zip type
        #   -v10m = split to 10 meg files
        #   -mmt = multithreading
    
        "7zip a -t7z -v10m -mmt=off $outputfile $input"               # echo out some progress    
    
        sevenZip a -t7z -v10m -mmt=off "$outputfile" "$input"         # 7zip them up
    
    }
    
    # we're all done, let's cleanup
    Remove-Item Alias:sevenZip
    
    Categories: powershell, SQL Server 2005

    Bing Maps API (via URLs)

    I've located a small page that describes the various functions available via Bing maps.

    Categories: Uncategorized

    Service Unavailable on SQL Services Reporting Services after Microsoft Patch

    Last night, my SSRS server failed on the first access attempt after Multiple Windows patches were installed by WSUS overnight (SQL Server 2005 EE, Windows 2003 SP2). This is not a critical server for me so it doesn't get tested before patches are applied. As such, it gets all patches immediately without testing and, in fact, is a test for such patches for me. Production servers have to be approved by hand after my test servers pass.

    Starting off in the Event Viewer > System, I'd see 5 W3SVC warning [a] and followed by a W3SVC failure [b]. Evidently, the rapid fail mechanism in IIS6 was shutting me down.

    • [a] 5 times: Event ID 1009; Source W3SVC; A process serving application pool 'DefaultAppPool' terminated unexpectedly. The process id was 'xxxx'. The process exit code was '0xffffffff'.
    • [b] 1 time: Event ID 1002; Source W3SVC; Application pool 'xxxxxx' is being automatically disabled due to a series of failures in the process(es) serving that application pool.

    Restarting application pools would just duplicate the same series of events.

    Looking in the Event Viewer > System, I examined which patches were applied overnight

    • KB974318
    • KB973904
    • KB971737
    • KB973917
    • KB974392
    • KB976325-IE8
    • KB955759

    KB973917 is 'a non-security update that implements Extended Protection for Authentication in Internet Information Services (IIS).'

    After reviewing each knowledge base article, I located a known issue for KB973917 that described my issue perfectly: 'Internet Information Services 6.0 may not function correctly after installing KB973917'. The solution is to reinstall SP2 for your Windows 2003 server. Per Microsoft, 'Reinstalling the KB973917 update should not be necessary'.

    If you want to enable the features this update provides, view here: 'http://www.microsoft.com/technet/security/advisory/973811.mspx'

    To Microsoft's credit, this is the first patch to cause a problem for me in over 3 years.

    Categories: SQL Server 2005, SQL Server Reporting Services

    Proudly powered by WordPress Theme: Adventure Journal by Contexture International.