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:
SET NOCOUNT ON
-- 1 - Variable declaration
DECLARE @backupPath NVARCHAR(500)
DECLARE @cmd 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.
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”
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”
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”
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?”
There are occasions where you would like to search in a varchar column and order the results based on the numeric part of the field.
Imagine the following table:
ABC3 and so on...
ABC13 and so on..
ABC22 and so on..
So basically what I have is any string value (not always ABC, any string value) that can either be followed by the number or it may just be a string without the number.
When you run
select * from table order by my column asc
you get following results:
In this scenario, you would need the results sorted by the numeric value and not alphabetically.
How can this be accomplished?
Continue reading “How to order a result set in SQL based on the numeric part of the string value”
Consider what happens when a user removes part of your URL Some users might navigate your site in odd ways, and you should anticipate this. For example, instead of using the breadcrumb links on the page, a user might drop of a part of the URL in the hopes
of finding more general content.
He or she might be visiting http://
but then enter http://www.brandonsbaseballcards.com/news/2016/ into the browser’s address bar, believing that this will show all news from 2016. Is your site prepared to show content in this situation or will it give the user a 404 (“page not found” error)? What about moving up a directory level to http://www.brandonsbaseballcards.com/news/?
A site map (lower-case) is a simple page on your site that displays the structure of your website, and usually consists of a hierarchical listing of the pages on your site.
Visitors may visit this page if they are having problems fiding pages on your site.
While search engines will also visit this page, getting good crawl coverage of the pages on your site, it’s mainly aimed at human visitors.
An XML Sitemap (upper-case) file, which you can submit through Google’s Webmaster Tools, makes it easier for Google to discover the pages on your site. Using a Sitemap fie is also one way (though not guaranteed) to tell Google which version of a URL you’d prefer as the canonical one (e.g. http://brandonsbaseballcards.com/ or http://www.brandonsbaseballcards.com/; more on what’s a preferred domain). Google helped create the open source Sitemap Generator Script to help you create a Sitemap file for your site. To learn more about Sitemaps, the Webmaster Help Center provides a useful guide to Sitemap fies