| A community of more than 1,600,000 database professionals and growing |
| | A Great Case for Powershell I think PowerShell is a great addition to the Microsoft stack. Given the previous versions of VBScript, Perl and Python ports, and more on Windows, PowerShell is a great improvement. Even for someone that spent a lot of time in the C Shell and Bourne Shell as a student and young professional, I think PowerShell is an improvement. There are certainly still things that make me crazy about PoSh, such as the -eq, but I'm getting more comfortable with the structures and flow. In SQL Server, we had the old SQLPS module, which was, well, a start. Then we got the SqlServer module, which is better. However, the best thing I've seen for us data professionals is the dbatools project from Chrissy LaMaire (@cl) and company. To me, this is incredibly useful for anyone that wants to use PoSh with SQL Server, but it's really indespensible for SQL Server migrations from instance to instance. I'm not sure I'd even try anything else at this point. Not everyone wants to use PoSh with SQL Server, and that's fine. There are certainly plenty of places where T-SQL works very well to manage and interact with SQL Server. I still prefer it for many things, but the more I work outside a database, whether for administrative actions or manipulating parts of the platform away from SSMS, PowerShell has some advantages. Not the least of which are cleaner file operations and certainly better string manipulation (IMHO). Recently I saw post from Drew Furgiuele about finding linked servers in your object code with PoSh. It's a long, somewhat convoluted post, and some of you might wonder if it's worth the effort. Hint, it's not worth the effort because Drew has done it for you. He's got the function on Github, and if you need to move linked servers, just use his code to help. My point is, however, that doing this in T-SQL would be a nightmare. Just going through search isn't helpful, though SQL Search is a great tool. The work to find the objects would be hard, and this isn't something you want to get wrong in a migration. It would be bad enough to have errors for non-existent linked servers, but it might be worse if you had code pointing to the wrong database. This is something you'd want to fix, and PoSh helps work with a complex problem here. There are other issues like this, other problems or requirements that look across instances or more intensely at parts of our systems outside of what we want to do with T-SQL. Certainly anything at scale, that might be something you do for many instances is better with PoSh, and certainly any infrastructure as code items that work to stand-up and configure SQL Server really should use PoSh. Don't make PowerShell a hammer, and try to solve all issues, but for the future, you really ought to be sure you are comfortable reading PoSh scripts and know how to use them with SQL Server. Learn when PoSh is a good alternative, and certainly know where you can get scripts or help with your code. Steve Jones from SQLServerCentral.comJoin the debate, and respond to today's editorial on the forums |
| The Voice of the DBA Podcast Listen to the MP3 Audio ( 4.1MB) podcast or subscribe to the feed at iTunes and Libsyn. The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. | |
|
|
| ADVERTISEMENT | | Don’t just fix SQL Server problems, prevent them from happening SQL Monitor helps teams looking after SQL Server be more proactive. Not only does SQL Monitor alert you to current issues, it gives you the information you need to stop them happening in the future. Download SQL Monitor now and get a 14 day free trial |
| | Become a more efficient SQL developer with SQL Prompt Learn how to write SQL faster and more efficiently with these exclusive short videos from Data Platform MVPs and SQL Server experts. With SQL Prompt you can strip out the repetition of coding and write SQL 50% faster. Check out the tips |
|
|
|
| | | Thom Andrews from SQLServerCentral.com SQL Server on Linux doesn't support Ubuntu 18.04 LTS. Why weren't Microsoft ready for the next LTS release? More » |
| Arun Sirpal from SQLServerCentral Blogs Last year I wrote about Azure SQL Database extended events (https://blobeater.blog/2017/02/06/using-extended-events-in-azure/) and gave an example where I was capturing deadlocks... More » |
| faig.garayev from SQLServerCentral Blogs I try to avoid dynamic SQL as much as possible and consider it as a necessary evil. However, in some... More » |
|
|
| | Today's Question (by Steve Jones): I have a database in which the last DBCC CHECKDB reported corruption errors. Before I try to repair this, I want to be sure I have a copy of the data in the event something goes wrong. I try to run BACKUP DATABASE MyImportantDB to DISK = 'MyImportantDB_PreRepair.bak' but I get an error. What can I do to get a full database backup? |
Think you know the answer? Click here, and find out if you are right. We keep track of your score to give you bragging rights against your peers. This question is worth 1 point in this category: Backup. We'd love to give you credit for your own question and answer. To submit a QOTD, simply log in to the Contribution Center. |
|
|
| |
ADVERTISEMENT | T-SQL Querying (Developer Reference) Squeeze maximum performance and efficiency from every T-SQL query you write or tune. Four leading experts take an in-depth look at T-SQL’s internal architecture and offer advanced practical techniques for optimizing response time and resource usage. Get your copy from Amazon today. | | |
|
|
|
|
|
| Yesterday's Question of the Day |
| Yesterday's Question (by Steve Jones): What happens with this code? SELECT COALESCE(5, CAST('A' AS INT), (SELECT (1/0))) Answer: 5 is returned Explanation: The COALESCE function works by only evaluating the parameters from left to right until one is not null. In this case, 5 is evaluated and returned. The invalid CAST and the improper math in the SELECT are never run. Ref: COALESCE - click here » Discuss this question and answer on the forums |
|
|
| Database Pros Who Need Your Help |
| Here's a few of the new posts today on the forums. To see more, visit the forums. Regex in SQL - Greetings, I am what you will call an accidental DBA. I was a Systems Engineer and now I have to watch... In what twisted SQL world will a JOIN result in more records than a LEFT JOIN - I have never seen this before and it goes against everything that I know about SQL data sets. I have... Storing multiple variations of the same data? - Can anyone weigh in on why you would want to store multiple variations of the same data? In all of... ????????????/Q603012914??????????????????????????????University of Guelph - ????,QQ/??:603012914,???????????????????????????????????????????Offer??????????????????????! ????“??????????,????????? ”???????????????????? ?????????????,???,????????????????,?????,????? QQ/??: 603012914 ???Bill ????: ????????(?????????,???????,??????!!!) ??????????????(?????????????;????,????,????,??,???,??,??--???) ????????????????(???????????,?????????) ???????? ????????????/Q603012914?????????YU????????????????????York University - ????,QQ/??:603012914,???????????????????????????????????????????Offer??????????????????????! ????“??????????,????????? ”???????????????????? ?????????????,???,????????????????,?????,????? QQ/??: 603012914 ???Bill ????: ????????(?????????,???????,??????!!!) ??????????????(?????????????;????,????,????,??,???,??,??--???) ????????????????(???????????,?????????) ???????? ????????????/Q603012914??????????????????????????????Carleton University - ????,QQ/??:603012914,???????????????????????????????????????????Offer??????????????????????! ????“??????????,????????? ”???????????????????? ?????????????,???,????????????????,?????,????? QQ/??: 603012914 ???Bill ????: ????????(?????????,???????,??????!!!) ??????????????(?????????????;????,????,????,??,???,??,??--???) ????????????????(???????????,?????????) ???????? ????????????/Q603012914??????????UW????????????????????University of Waterloo - ????,QQ/??:603012914,???????????????????????????????????????????Offer??????????????????????! ????“??????????,????????? ”???????????????????? ?????????????,???,????????????????,?????,????? QQ/??: 603012914 ???Bill ????: ????????(?????????,???????,??????!!!) ??????????????(?????????????;????,????,????,??,???,??,??--???) ????????????????(???????????,?????????) ???????? ????????????/Q603012914????????????????????????????????McMaster University - ????,QQ/??:603012914,???????????????????????????????????????????Offer??????????????????????! ????“??????????,????????? ”???????????????????? ?????????????,???,????????????????,?????,????? QQ/??: 603012914 ???Bill ????: ????????(?????????,???????,??????!!!) ??????????????(?????????????;????,????,????,??,???,??,??--???) ????????????????(???????????,?????????) ???????? ????????????/Q603012914???????????UWO????????????????????University of Western Ontario - ????,QQ/??:603012914,???????????????????????????????????????????Offer??????????????????????! ????“??????????,????????? ”???????????????????? ?????????????,???,????????????????,?????,????? QQ/??: 603012914 ???Bill ????: ????????(?????????,???????,??????!!!) ??????????????(?????????????;????,????,????,??,???,??,??--???) ????????????????(???????????,?????????) ???????? ????????????/Q603012914??????????UT????????????????????University of Toronto - ????,QQ/??:603012914,???????????????????????????????????????????Offer??????????????????????! ????“??????????,????????? ”???????????????????? ?????????????,???,????????????????,?????,????? QQ/??: 603012914 ???Bill ????: ????????(?????????,???????,??????!!!) ??????????????(?????????????;????,????,????,??,???,??,??--???) ????????????????(???????????,?????????) ???????? SQL Cluster one instance fails when failed over - I built two windows 2012 R2 VM (VMWARE) Cluster servers with SQL 2014 Enterprise Installed instance One have databases loaded and when... Change formatting of SSMS generated code - Hi all, not exactly the most pressing query ever, but after all these years I've finally cracked. Is there any way... Looking for any known issues with SQL Server 2012 SP4 - Hello experts, Does anyone know of a central link describing any issues people have run into after installing SP4 on a... Restoring database A also tries to Restore database B - Hi Guys, Had a very strange is happen to me, I was required to restore our production db to a specific... Moving TempDB to local non-clustered drive - We are seeing very high Average Disk Queue Length numbers in one of our clusters (both nodes of the cluster... Stored Procedure output to Excel - Could use some help on this one: I have a SQL Server 2008 64bit and try to put data in... MDX query behaviour - Hi All, I am facing a problem while querying on hierarchical data from cube.The problem area is nth level is having... How to Design Dimensional Model? - Hi, Can any one shed some light on how to Design Schema / Dimensional Model with an existing non Dimensional Data Warehouse,... create temp view - Is it possible to create a temporary view from within a stored procedure for the life of the stored procedure.... The SQL Saturday Thread - As popular as SQL Saturday is, I'm surprised that nobody created a thread dedicated to SQL Saturday, so I created... |
|
| This email has been sent to [email protected]. To be removed from this list, please click here. If you have any problems leaving the list, please contact the [email protected]. | This newsletter was sent to you because you signed up at SQLServerCentral.com. Feel free to forward this to any colleagues that you think might be interested. If you have received this email from a colleague, you can register to receive it here. | This transmission is ©2018 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. Contact: [email protected] |
|
|