Restore all the backup files from inside a folder on SQL Server – TSQL Script

First, you will need to enable xp_cmdshell

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

Next, you will need to change the path to the directories:

USE Master; 

-- 1 - Variable declaration 
DECLARE @backupPath NVARCHAR(500) 
DECLARE @fileList TABLE (backupFile NVARCHAR(255)) 

-- 2 - Initialize variables 
SET @backupPath = 'F:\baks\' 

-- 3 - get list of files 
SET @cmd = 'DIR /b "' + @backupPath + '"'

INSERT INTO @fileList(backupFile) 
EXEC master.sys.xp_cmdshell @cmd 

SELECT 'RESTORE DATABASE [' + LEFT(backupFile, CHARINDEX('_', backupFile, 12)-1) + 
'] FROM DISK = '''  
       + @backupPath + backupFile + ''' WITH RECOVERY, REPLACE
	 GO'  from @fileList

Copy the generated script into a new window and voila! Your script is done. Just press F5 to run it.
Don’t forget to turn off xp_cmdshell when done.


Make Every Page Link-Worthy

Ten or fifteen years ago, the best web programmers were the ones who could balance visual effect and code economy .

In other words, there was no reason for a line of code unless its result was a benefit to the site. Limited bandwidth created a value for fast-loading pages. For users with a limited bandwidth of, for example, 56 Kbps, every second was valuable and any extraneous coding simply wasted time.

Similarly , the philosophy behind link-worthy pages is that there’s no reason to create a page if that page has no chance of ever being linked to for one reason or another, from some site or another. Continue reading “Make Every Page Link-Worthy”

Link Building Techniques

Acquiring additional inbound links is the common solution that helps solve most of the problems that SEOs run up against. To make this difficult task a little easier for you, I have compiled a list of some of my favorite link building techniques. Not all of these techniques work for all people, but the list is long enough that you can almost undoubtedly find a technique that works for your case. Continue reading “Link Building Techniques”

Survival tips for small businesses

You may a local merchant with 150 employees; whichever, however or whatever—you’ve got to know how to keep your business alive during economic recessions. Anytime the cash flow in a business, large or small, starts to tighten up, the money management of that business has to be run as a “tight ship.”

Some of the things you can and should do include protecting yourself from expenditures made on sudden impulse. We’ve all bought merchandise or services we really didn’t need simply because we were in the mood, or perhaps in response to the flamboyancy of the advertising or the persuasiveness of the salesperson. Then we sort of “wake up” a couple of days later and find that we’ve committed hundreds of dollars of business funds for an item or service that’s not essential to the success of our own business, when really pressing items had been waiting for those dollars. Continue reading “Survival tips for small businesses”

What’s the difference between a user story and an Epic when it comes to Agile?

They are very generic term actually. There is many way to interpret them, varying in the literature and how people see them. Take everything I say with a huge grain of salt.

It takes a thousand voices to tell a single story

Usually, an Epic comprise a very global and not very well defined functionality in your software. It is very broad. It will usually be broken down into smaller user story or feature when you try to make sense of it and making them fit in an agile iteration. Continue reading “What’s the difference between a user story and an Epic when it comes to Agile?”