Posts

CoPilot Summary: SQL Server Drivers over Time

Just sticking this here for my own future reference: I asked on 09/11/2024: Wasn't there already an ODBC drive for SQL Server? I'm so confused, lots of drivers have come and gone, and I can't remember their history or which one I should use for which version of SQL Server. CoPilot Responds: I get it, the history of SQL Server drivers can be quite confusing! Here’s a brief overview to help clarify things: ODBC Drivers : SQL Server ODBC Driver : This was the original driver and is still part of Windows Data Access Components, but it’s not recommended for new development 1 . SQL Server Native Client (SNAC) : Introduced with SQL Server 2005, it included both ODBC and OLE DB interfaces. It was used up to SQL Server 2012 1 . Microsoft ODBC Driver for SQL Server : This is the current driver, introduced after SQL Server 2012. It’s updated with the latest features and is recommended for new development 1 . OLE DB Drivers : Microsoft OLE DB Provider for SQL Server (SQLOLEDB) : Part o

Specify the Server Name in your OutputFileDirectory for Hallengren SQL Server Backups

I've been playing with SQL Agent tokens more, researching how Ola Hallengren uses them in his famous Maintenance Solution, and how you can use them. Particularly I was looking for a way to specify the "ServerName" in the Output File path. You can do this using a token instead of having to customize the MaintenanceSolution.sql script for each server. This is helpful when you're doing environment takeovers and trying to get consistent backups going across several servers. Here is an example of our solution, which is working well. You would modify line 29 of Ola's script:   DECLARE @OutputFileDirectory nvarchar ( max ) = '\\MyBackupServer\DBBACKUPS\ $(ESCAPE_SQUOTE(SRVR)) \OUTPUT' Then for each job step, Ola will setup the following output file. This can be seen in the "Advanced" properties of a particular Job Step. '\\MyBackupServer\DBBACKUPS\$(ESCAPE_SQUOTE(SRVR))\OUTPUT\$(ESCAPE_SQUOTE(JOBNAME))_$(ESCAPE_SQUOTE(STEPID))_$(ESCAPE_SQUOTE(DAT

Vote for "Deleted File Content Search" in Azure DevOps!

I’ve submitted a feature request to the Azure DevOps team to allow us the option to search the contents of “deleted” files in the Azure DevOps Repo code search. Feel free to vote for this feature here 😊 https://developercommunity.visualstudio.com/t/Search-for-Deleted-Files-and-within-Dele/10689684

Tuning Costs on my Azure Development Machine

I’ve been storing my development machines up in Azure instead of buying a new laptop. And I really like this approach.  By far the most useful aspect is that I needed to completely rebuild a machine the other day to get my development tools all working properly. The conversion from an older version of my dev tools to a newer version did not go so well, and the solution turned out to be just moving to a new machine. In Azure this was trivial as I just fired up a new VM. But this is something you could do locally as well, and I’m wondering if I need to do that, because one thing I’m learning is that AZURE can be Expensive. Now by “expensive” it should be noted that I just hit $60/mo in my VM dev environment, so not actually that much money, but it’s an environment I only use a few hours per month for side work, so very expensive per hour. A couple of issues I’ve had: When you remove a VM, it doesn’t automatically remove the disks, which is maybe a good thing, but on a VM you on

Hiding an ASPXGridView Delete button with HTMLRowCreated vs. CommandButtonInitialize

It's pretty typical in Administration forms to need to hide buttons on certain rows for various reasons. Particularly it is nice to hide the Delete button if in fact the row in question is being used in other places in the app. This is a nice feature to let the user know up front that the row in question is in use, rather than them trying to delete it and getting a foreign key related error after the fact. For years now in DevExpress ASPxGridView's I have been handling this in the HtmlRowCreated event. And I have been doing it wrong. Before: protected void gridGiftCodes_HtmlRowCreated ( object sender, DevExpress.Web.ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data){ int commandColumnIndex = - 1 ; //Find the command column commandColumnIndex = e.Row.Cells.Count- 1 ; //assume it's the last visible colum //Get the command cell for this row GridViewTableCommandCell cell = e.Row.Cells[commandColumnIndex] as Gri

Log4Net Primer

My notes on Log4Net, which is a great logging utility I've been using in a lot of console apps lately. It's beautiful. References: Great Introduction Video by Tim Corey - the first 45 minutes were sufficient for me: https://www.youtube.com/watch?v=2lAdQ_QwNww&feature=youtu.be Tim Corey’s original article: http://www.codeproject.com/Articles/140911/log-net-Tutorial Official Documentation, very thorough: http://logging.apache.org/log4net/index.html Summary: log4Net is a great logging tool for .Net applications. You can log at different “levels” like Debug, Info, Warn, Error, Fatal, and send different levels of logging to different places. For example all messages could go to the console, but Error or Fatal messages can go to a log file or a database. The basic steps are: Add log4Net to your program via NuGet Configure log4Net settings in your App.config Configure various “appenders” for all the targets you want to log to, and what format of