Monday, 17 March 2014

Mini Post: SQL Replication - Changing The Default Snapshot Folder

Hello and good day, wherever you are! Welcome back to SQL Something!

Today's Mini Post is how to change your default snapshot folder for SQL replication. A snapshot is necessary to initially initialize the database that the replicated data is being sent to. So let's look at the process, quickly and with pictures!

Pictures make everything better.

Monday, 10 March 2014

Mini Post: Group By Month (or Year)

Hello to all of you out there! Welcome back to SQL Something!

Today's Mini Post is showing how to group by a date part (such as month, year) when given a start and end date.

Today specifically we are going to group by month in the following example:

SELECT DATENAME(month, YourDateField) MonthName,
                DATEPART(month, YourDateField) MonthNumber,
                COUNT (YourField) FieldTotal
FROM YourTable
WHERE (YourDateField >= '01/01/2013' and YourDateField < '01/01/2014')
 -- AND add other criteria here
GROUP BY DATENAME(month, YourDateField),
                     DATEPART(month, YourDateField)
ORDER BY MonthNumber;

And that's all there is too it. :-)


DISCLAIMER: As stated, I’m not an expert so please, PLEASE feel free to politely correct or comment as you see fit. Your feedback is always welcomed. :-)

Monday, 17 February 2014

Product Spotlight: Idera's SQL Virtual Database

Hey everyone and welcome to (and/or welcome back, hopefully) to SQL Something!

Today I'm trying something a little different. Today I'm going to take a look at a specific SQL related product for the first time. I honestly don't know how often I will be doing these but we'll see!

So did you ever wish you could just query a backup? Yes, just like a DB but without having to restore it? Yes, without restoring it, so you don't have to cater for additional space for the restore or cater for the time taken to perform the restore.

Not possible?

It is with Idera's SQL Virtual Database.

Fig. 1: Main Screen.


Monday, 3 February 2014

Mini Post: The Process Could Not Execute sp_replcmds

Good day out there and welcome back to SQL Something!

Today we're going to look at a small error which is related to the permissions on a DB that is being used for publishing in SQL replication.

After setting up my publication and a subscriber to be used for transactional replication, I noticed that transactions were not being replicated. Upon checking the "View Log Agent Status" (right click the publication and choose the option), I saw the following error: "The process could not execute sp_replcmds".

Fig. 1: The Error in Log Reader Agent. It can also be found in the Replication Monitor, under the 'Agents' tab.


Wednesday, 29 January 2014

Mini Post: Backing Up/Restoring From The Command Line

Hey everyone and welcome back to SQL Something!

I happened to see an old post of mine (towards the bottom of the post) where I mentioned restoring from the command line but I did not actually say how.

So that's what I want to look at really quickly.

Monday, 27 January 2014

Convert Comma Delimited String To A Table

Welcome back to SQL Something everyone!

Just seeing if I could throw one more post in before the end of the month (trying so hard to stick to my "at least 2 posts per month" rule).

Today we'll look at how to convert a comma delimited string to a table, where each delimited value will be placed in a new row.

Thursday, 23 January 2014

Mini Post: Restore of Database Failed; Access is Denied

Happy New Year! (Albeit a little late!)

Welcome back to SQL Something!

To start off the year we'll look at a very small issue: "The operating system returned the error '5(Access is denied)' while attempting restore".


Fig. 1: Access is Denied