Just Hold on a Minute There! – Making a Batch File Wait

I read a fascinating web page today while I was trying to get a batch file I was writing to wait a few seconds before executing its next command. Running off to the net I managed to find the information on Rob van de Woude’s website at http://www.robvanderwoude.com/wait.php.

The way he tackles the problem is to ping an unknown ip address (thus causing an error) and setting that ping to wait a set amount of time before trying again. Having told the command to only attempt the ping once, it will then pass control back to the batch file. Adding insult to injury, even the error message is elegantly sent to “>nul” or nowhere if you like. Brilliant!

I know, I know. Its geeky but just try to remember, this is me writing this! 😀

Share

The New World of Work

Rather a grandiose title I’ll grant you but that’s what Microsoft are telling us to be ready for. Lots of kids born in the 80s, people over 50 and shock of shocks, WOMEN in the workplace! What the blue blazes is wrong with the world!! 🙂
Joking aside, I managed to find their White Paper about what to expect and I’ll admit, its an interesting read.

Have a look at the White Paper and you’ll see what I mean.

Until next time,
E

Update: TechRepublic have been looking at Generation Y for some time now, have a look at their recent post about how IT departments should adapt. (Have a look at http://blogs.techrepublic.com.com/hiner/?p=623&tag=nl.e138)

Personally speaking, I welcome the challenge of integrating all the devices and ideas that will come with these people, however I still maintain that checks and measures must be in place to ensure the legality of everybody’s actions. Too many disks, laptops and files have been lost already. 😀

Share

Creating the alter ego blog: catseyecarving.co.uk

For those of you who don’t already know, I’m sort of running two blogs at the moment. This one obviously, and http://www.catseyecarving.co.uk which is a joint effort between me and my partner Carrie. Carrie’s blog is all about her work as a stonemason, based in the Harts Barn Craft Centre in the Forest of Dean.

Setting up a WordPress blog for her site has been rather a labour of love over the past few weeks. I’m delighted to say its now up, running and functioning exactly the way Carrie wants it to. Carrie’s speed reading a book about blogging so I expect I’ll have some new projects to undertake and plugins to install in the near future!

This post is more as an apology than anything else. Yes, I’m delighted to have been able to help Carrie get her blog running, I’m just aware I’ve been neglecting this one while that was going on.

In order to keep the blog contents fresh and hopefully interesting, I’m going to depart somewhat from the original brief I gave myself for this blog. I’d like to try incorporating the brain dumps I already put up here with a few more chatty posts (mainly because they’re easier to write!!). Please leave a comment on one of my posts if you’d like anything further about the subject matter and thanks for reading.

Ed

Share

Setting the SQL Server Campatibility mode to 90 on all databases

OK, so I know I’m jumping the gun a little, I’ll be posting some stuff about how I moved over my databases to the SQL 2005 box later. I’ve just been working on this stuff all morning so I thought I’d upload the script I wrote quickly.
This script creates as an output a number of SQL commands that will change the compatibility modes of all databases on your server. That said, if you change the command in the cursor, it can be used to change anything on all databases.
Basically, you just run the script, copy the outcome and run that. This will allow you to remove any databases you don’t want or change anything you like before running the eventual script.
The script genrating script idea was one I pinched from Microsoft I’m afraid.

Click Here to get the Code

Run it then in the results pane you’ll see all the commands ready to be copied and pasted into the query window.
Nice! 🙂

Share

Finding out the paths to SQL Database Data Files

 

Finding out the data and log file locations in SQL Server can sometimes be a little fiddly. With that in mind, I’ve been looking for a way to list the files used by each database. Whether for system or disaster recovery documentation, it can sometimes be handy to have this kind of info available to you.

Finding out where the mdf (database file) is can be pretty easy. Its held in the Master database somewhere. Its only when you want to check where both the mdf and ldf (transaction log file) are stored that it can get a bit tricky.

 

The way I’ve been doing it involves a cursor that creates a new line in a temporary database for each database you have on that particular server. Ordinarily to get where the database and log files are kept you’d use a query like the one below:

EXEC sp_helpdb ‘master’

 

What I’ll be doing is something that works similar to this but basically does it for all the databases in one command.

Get the name of the first database

Query the database for its file locations, writing them to the temporary database

Get the name of the second database…..

Etc

 

So, here goes with the actual code: 
 

Click Here to get the Code 

 

I don’t have any databases that use more than the primary filegroup so I’m afraid this won’t help users that may be doing that.

For us simple people however, this will give you a report that can be used in disaster recovery docs and the like for years to come. 🙂

 

Share