Category: Blog

  • Google Wind

    transmission_270x229[1] I’m not sure Google is a better company than Microsoft or some of the other extremely large companies that get caught up in dominating a market. However they are engaged in some interesting projects, and I have to think that the founders, or someone high up in management is really looking to solve some problems in the world.

    Google is funding a power backbone for offshore wind farms. Essentially an undersea cable to carry electricity from offshore windmills. IT looks like it will go from near my hometown of Norfolk up to the New Jersey/New York area.

    I’m not sold this is the best way to get wind power from the coasts, but it’s worth trying. I worry about the issues of the ocean damaging the equipment over time. I’d love to see more installations along the Eastern Shore first, maybe vertical windmills that might not harm birds.

    I’m glad that Google is willing to make the $5B investment in it and try to jumpstart some offshore farms. Especially as we use more and more power for these digital devices. I know there are some nice coast guard installations about 7mi offshore that I used to dive near.

  • T-SQL Tuesday #12 – Misconceptions

    TSQL2sDay150x150 It’s time for T-SQL Tuesday again, and I’m happy to participate again. This is a monthly blog party started by Adam Machanic (Blog|Twitter )that asks people to write on a particular topic all on the same day.

    This month’s theme is misconceptions in SQL Server, hosted by Sankar Reddy. You can read the rules for the party and get information from his blog.

    The Most Common Misconception

    I read a lot of forum posts, literally hundreds a week on all topics in SQL Server. One thing that I consistently see asked is the dreaded:

    “My transaction log has grown so large it filled the disk”

    That’s a common occurrence, too common in my opinion, and while there are people that forget to setup any backups, I also find in the majority of cases people just don’t understand one thing:

    A full backup does not clear the transaction log.

    Too many people assume that the log will get managed by a full backup. It doesn’t. While some log record get included in a full backup, they do not get marked as “backed up” and the space re-used.

    If there is one thing that I wish everyone managing a SQL Server knew, it would be that they need to make full and log backups to properly manage the disk space usage by their logs.

  • Return Values from XP_CMDSHELL

    Let’s be clear: I don’t recommend the use of xp_cmdshell as a general tool. It ought to be used when you have no alternatives, and you should carefully control access and what this can do. Opening a shell from SQL Server can be dangerous for your server.

    That being said, I do think there are places that xp_cmdshell works great and if you need to use it, how do you tell if the commands you executed were successful?

    For those of you that have worked in command lines, or remember DOS, there is a thing called an Errorlevel, that is returned by programs when they exit. For many of us that used to program in DOS, we always checked ERRORLEVEL when exiting a program, and we made sure that our program always returned a 0 if it exited without an error. That’s a standard that has been in place as long as I can remember working with computers.

    How can we use this? If I execute this in a command window:

    errorlevel

    I get an instance of Notepad on my screen. When the CD.exe application completes, it sets the errorlevel to 0. Technically it returns a 0 to cmd.exe, which sets the errorlevel to that value.

    What about this:

    errorlevel2

    In this case, nothing happens. However if I switch the command to:

    errorlevel3

    Then I get notepad again.

    How can we use this in SQL Server? When xp_cmdshell exits, it returns the errorlevel from it’s shell. Let’s test it. First, enable xp_cmdshell

    -- To allow advanced options to be changed.
    EXEC sp_configure 'show advanced options', 1
    GO
    -- To update the currently configured value for advanced options.
    RECONFIGURE
    GO
    -- To enable the feature.
    EXEC sp_configure 'xp_cmdshell', 1
    GO
    -- To update the currently configured value for this feature.
    RECONFIGURE
    GO

    Now execute

    DECLARE @i INT
    EXEC
    @i = xp_cmdshell 'dir'
    SELECT @i

    This returns the current directory (\Windows\System32 in this case) and a 0.

    errorlevel4

    Now if we change to our other example:

    DECLARE @i INT
    EXEC
    @i = xp_cmdshell 'cd tim'
    SELECT @i

    We get these results

    errorlevel5

    Since that’s not a valid path on my system, the DOS error is returned as a result, and the errorlevel is returned in the variable assignment.

    You can use this to test and see if your commands execute before you do something, like try to parse a directory listing that isn’t there.

  • Career Warfare – Book Review

    70618861[1] I picked up Career Warfare on the recommendation of a friend that had seen the Modern Resume presentation. I grabbed it as an e-book and have been reading it for the last few months, at a fairly slow pace (for me).

    I often read a book in a week, but in the case of this one, I would read part of a chapter, and spend a day or so thinking about it. Digesting the information, and seeing how it might be applicable to my career, and my brand.

    The author, David D’Alessandro rose to CEO of John Hancock Insurance, and you have to keep that in mind. The book is written as a tool for how you might advance your career in corporate America, and it includes lessons for upper management, many of which don’t apply to most of us. Items like dealing with the press aren’t something the average person needs to think about.

    However there is some great advice in there about how you should grow your career, and the impact that you have on your career based on your actions.

    I highly recommend it, and there are a couple of great pieces of advice in there. Most importantly, you are always building your brand. Slowly, surely, but every day you go to work, or interact with people professionally, you are building your brand. I like that he stresses honesty and integrity as well.

    There are some things I don’t necessarily agree with, like not bringing your spouse to social events, or not drinking at all, but if you are attempting to rise to the C-level ranks, perhaps that’s good advice.