Search results

  1. P

    Repeat the same operation on multiple lines in SSMS

    Suppose the following scenario happens. Finance sends you a list of invoice numbers and asks you to pull data on them. So you fire up SSMS, copy and paste in the list of invoices, and manually start adding start- and end quotes as well as commas around them. First row: Press Home to start at...
  2. P

    Switch Query Environment in SSMS

    Learnt this today from a consultant, and since it's a quick little trick, I figured I'd share it. When you work in different environments, you sometimes want to test your query from DEV in QA, or from QA in Prod to verify the actual data. I used to copy the query to Clipboard, then connect to...
  3. P

    Prevent Windows 2012 Servers from rebooting after Windows Update

    One would think that by default a server is configured not to automatically reboot after it installs updates. This is not the case, and I have encountered several cases where while I'm logged into a machine, it suddenly decides on its own that it's reboot time (Damn you Skynet!). Here's how to...
  4. P

    Line numbers in Management Studio

    Certainly one of the most useful little tricks I recently stumbled onto is enabling line numbers in SQL Server Management Studio. How often have you looked at an error message that mentions a line, and then had to click at random spots in your code and then checked the satatus bar...
  5. P

    SSIS - Attunity Connector for Oracle

    If you ever needed to pull data from Oracle using SSIS, you'll know it's quite a pain, and the process is rather slow. Your first struggle will be to figure out exactly which Oracle client you'll need. Chances are you run a 64-bit server. The problem here is that SSIS runs in Visual Studio...
  6. P

    Installing custom SSIS DLLs

    At work, we use Google Analytics (GA) a lot. I recently came across a product that allows you to connect to GA from SSIS. However, at the time of writing, it is only a bunch of DLLs, and requires registering these in the Global Assembly Cache by means of gacutil.exe. My SQL Server did not have...
  7. P

    Cannot obtain the required interface ("IID_IBSchemaRowset")

    I've been attempting to connect my SQL Development box at work to Oracle lately, and it's been a real struggle. I'll see if I can document the process a bit, in case someone else ends up running into issues (Why is it so difficult to set up a connection to Oracle to begin with?). Today, after...
  8. P

    Shrinking a Transaction Log

    I figured I would start putting some of the scripts I use regularly onto the site. Here's a small snippet of code to find out the (logical) name of the Transaction Log, and then shrinking it to a new size. I use it whenever I receive a database backup from a client's production database...
  9. P

    Indexes on a table

    Below is a small script that can be used to check whether or not a particular table in your database contains redundant indexes. By redundant indexes I mean that if there is one index on columns A and B, and a second index on columns A, B, and C, generally speaking, it would be sufficient to...
  10. P

    Why you should not prefix your procedures with "sp_".

    By default, the stored procedures in SQL Server have a pretty easy naming convention: Regular stored procedures are prefixed with "sp_". Extended stored procedures are prefixed with "xp_". Most people developing against SQL Server will find themselves inclined to prefix their own stored...
  11. P

    SQL Server - T-SQL Password generator

    While trying to write another script, I suddenly had a need for a password generating script for SQL Server. I previously wrote one in C#, but figured it might also be useful having a T-SQL version of it, so I set off to write one. I ended up doing it as a stored procedure, which in the script...
  12. P

    Dynamics NAV error - "There is not enough memory to complete the current activity"

    Should you ever attempt to run an upgrade from a native Navision (CSIDE) database to a SQL Server database, and end up seeing an error "There is not enough memory to complete the current activity", chances are that prior to the upgrade, you ran the Microsoft Upgrade Tool from PartnerSource...
  13. P

    Corrupt database: Could not read and latch page (foo:bar) with latch type SH

    Every so often, a database will end up in a corrupt state. There's nothing much you can do to about it, as normally speaking, these types of failures just happen. You can minimize the impact on your business by using redundant hardware and a solid backup strategy, but you might still have to...
  14. P

    DTA objects - Database Engine Tuning Advisor

    While running a policy check, I stumbled across a number of objects with 'dta_' in their name. If you find similar objects, then these are left-over objects of running a Database Engine Tuning Advisor session that for some reason did not finish and thus did not clean up properly after itself...
  15. P

    Performing a SQL Server 2012 - Evaluation Edition Upgrade

    If you're one of the early birds, you grabbed a copy of SQL SErver 2012 - Evaluation Edition. Then chances are you recently received a message that your evluation period ended. If you want to upgrade to another version of SQLServer 2012, this guide might help you do so. First, you should...
  16. P

    SQL Server Objects: Triggers

    A few years ago, during a job interview, I was presented with a scenario where the idea was to perform certain actions upon data being entered into a table. It was not as straight forward as simply being a matter of adding a record (that's when foreign keys would have sufficed), but involved...
  17. P

    SQL Server 2000 system tables and their 2005 Dynamic Management View (DMV) equivalents

    Those who have been working with SQL Server administration for a while now undoubtedly have at times refered to the old SQL Server system tables in order to automate some processes, or document their tables by for example combining the sysobjects and syscolumns tables. As per SQL Server 2005 and...
  18. P

    Signing up for SQL Azure

    Please note that the free offer described in this article is valid until Septermber 2011, and after that will be charged at regular rates. Yesterday, I started checking out SQL Azure. I figured that I would also use the Introduction offer that is available to all MSDN subscribers, and hook...
  19. P

    SQL Azure - Security Overview

    While looking into learning more about Azure, I came across a video made by Microsoft's Ola Ekdahl. In it, he shows a slide with some differences between your typical local installation of SQL Server and SQL Azure security. Seeing the slide might be useful to see in a more static way, I...
  20. P

    SQL Azure Videos - Part 5

    SQL Azure Pricing Explained SQL Azure: Creating Your First Database Interacting with a SQL Azure Database
Top