Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
The Voice of the DBA
 

Daily Coping Tip

Give positive complements to as many people as you can today

I also have a thread at SQLServerCentral dealing with coping mechanisms and resources. Feel free to participate.

For many of you out there working in a new way, I'm including a thought of the day on how to cope in this challenging time from The Action for Happiness Coping Calendar. My items will be on my blog, feel free to share yours.

The (Former) Complexity of PowerShell

This editorial was originally published on Jan 19, 2017. It is being republished as Steve is at SQL Bits today.

When I first looked at PowerShell, it was v1.0, and I was in a TechEd presentation. The language seemed a mile past the VBScript I was using when T-SQL didn't function well. The ability to access the .NET namespace, work with objects, and program with error handling was exciting. I played with the language a little, but didn't find that many places to use it at the time.

Certainly file operations were much easier with PowerShell, and I built scripts to copy backup files around the network. AD operations were easy in PoSh. However, when I tried accessing SQL Server, I thought the code was complex. In fact, whether I was running a stored procedure, or performing a restore, the PowerShell code required was cumbersome. A good example is shown at the beginning of Aaron Nelson's recently updated post on querying with PoSh. The complexity shown to just make a connection to PoSh made me think I should just write that kind of code in C#, with all the debugging and other software support available in Visual Studio. Building quick utilities with PoSh was something I'd like to avoid.

When I heard that SQL Server Powershell was being updated, I wasn't too excited. I had visions of there being newer versions of cmdlets, but a similar level of effort to work with SQL Server. However, as I've played with the new cmdlets, along with the dbatools module, I see PoSh becoming easier to use than T-SQL in some cases. In fact, I've started to keep a command line window open (with ConEmu) and access that to perform lots of quick tasks that aren't based on simple queries of data. Even a backup with Backup-SqlDatabase seems as simple as it might be in T-SQL, perhaps more so if I don't have an SSMS connection open.

I know there can be a debate over whether you need PoSh as a DBA or you can get by with just T-SQL. I don't want to take a side here, and no matter how you feel, if you can get work done, then you are successful. Your job depends on you being able to reliably write code to perform some task over and over. The language doesn't matter.

My view is that I think there are cases where PoSh seems a better fit and places where T-SQL works really well. I want to improve my skills in both so that I can decide what works best in any particular situation, and feel comfortable in building a solution either way.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 Featured Contents
Stairway to Row-Level Security

Stairway to ScriptDOM Level 1 - An Introduction to ScriptDOM

Diligentdba 46159 from SQLServerCentral

Get an introduction to the Stairway Series and learn about the power of the ScriptDOM library.

External Article

DAX table functions for paginated reports: Part 2

Additional Articles from SimpleTalk

To return detail data using DAX, use the table functions. Adam Aspin covers UNION, EXCEPT, INTERSECT, and CALCULATETABLE in this article.

External Article

Demo webinar: SQL Monitor

Additional Articles from Redgate

Managing your entire SQL Server estate, on premises, in the cloud or a hybrid, with instant problem diagnosis, intelligent and customizable alerting has never been more vital. Discover how Redgate’s SQL Monitor enables all this from a single pane of glass.

Blog Post

From the SQL Server Central Blogs - Check if File Exists Before Deploying SQL Script to Azure SQL Managed Instance in Azure Release Pipelines

Meagan Longoria from Data Savvy

I have been in Azure DevOps pipelines a lot recently, helping clients set up automated releases. Many of my clients are not in a place where automated build and...

Blog Post

From the SQL Server Central Blogs - Help, not all of my column is displaying in the output of the query!

Kenneth.Fisher from SQLStudies

I’ll be honest, I don’t remember if I’ve written about this before but I couldn’t find it, so here we ... Continue reading

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

The Plan Cache Plan

What type of plan is stored in sys.dm_exec_query_plan?

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

Azure SQL Database DTU Tiers

What are the Azure SQL Database, single database service tiers if I want to pay under the DTU model?

Answer: Basic, Standard, and Premium

Explanation: The DTU purchasing model includes Basic, Standard, and Premium levels. Ref: Service Tiers - DTU - https://docs.microsoft.com/en-us/azure/azure-sql/database/service-tiers-dtu

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.


SQL Server 2017 - Development
How to get Two averages when the Number is defined as nvarchar ? - Hi experts, Sorry for not getting you a table or data at this moment but I will if I need to get help tomorrow How do I get Average of Cost 2. Average cost of Home Dept vs Overall Average Cost (Example: Home Department) Average Selling Prices of Each dept against over all selling price […]
Starting a beginner SQL server job - Need books, resources, ideas to learn - Could someone please give me some advice regarding SQLserver and SQL in general? I have some experience, but it was too long ago and I need to freshen up. Books, links, ideas, concepts that need to be known not to get fired the first day. Thank you.
SQL Server 2016 - Administration
SQL Agent Job - Hello, One of the full back up job failed and it was triggered again. The DB's size is big so it takes couple of hrs to complete. My questions is ....if the running job does not finish before the scheduled time when it starts...will it fail or stop current run?   Is there a way […]
Read previous days transaction log .trn - Is there a utility or script that I can see the Transactions that happened in a Trn log backup file (.trn). I would like to see what transactions and tables where updated in the Backup log. Thanks.
SQL Server 2016 - Development and T-SQL
units divided by quantity and order by date - Hi Expert, I am facing challanges for logic to apply all previous units sold divided by next or nearest dates quantity here is the query Create table ratio1 (UNIT1 int,CONS integer,SaleDateId date,consumables integer) insert ratio1 values (4444444,222,'20210407',10), (4444444,333,'20210407',15), (4444444,444,'20210407',24), (4444444,555,'20210407',24), (4444444,777,'20210412',10), (4444444,888,'20210414',16), (4444444,999,'20210414',20), (4444444,000,'20210421',10) ========================================= create table main ( oid int, UNIT1 int,SaleDateId date, quantity […]
Development - SQL Server 2014
List Dates between Start and End Date - Hi I have a very simple query as below select Personid, StartDate, endDate from table where startdate >= '01-feb-21' Example Data 223, 01-Feb-22, 04-Feb-22 354, 21,Feb-22, 22-Feb-22 I want to display it now as follows, so listing the days between the startdate and enddate for each personid Data would be as follows 223, 01-Feb-22 223, […]
SQL Server 2019 - Administration
Problem with Secure Enclave attestation - Hi all, long time lurker, first time posting. Looking for some help with an error I am seeing with our Always Encrypted with Secure Enclaves setup. In our production environment when our user load increases during the day I am seeing exceptions as follows: Failed to create enclave session as attestation server is busy. We […]
SQL Server 2019 - Development
Automatically output Extended Events data to table - Hi there, I was wondering if/how I would be able to output the results of an Extended Events session to a database table, either in real time or on a regular schedule. I have seen it suggested that the ring buffer could be used as a target, then that could be queried regularly and copied […]
Merge into a subset of the target - I have a table with a column named JDX that I wish to merge into and I want to limit the merge considerations to the set where JDX is 180. I reduced the fields being updated for brevity. It works on the "matched " and "not matched by Source" by adding "and jdx = 180" […]
Remove values between single quotes. - Hi   So Ive got a SQL trace uploaded into a table and I 'm looking at the ad-hoc calls, I want to summarize them and remove any values from the calls e.g instead of select id,jobcode from table where id = '1' and jobcode in ('s','l') I want to be left with select id,jobcode […]
Extract date from a text field - I'm trying to extract date from a text field.  I'm using PADINDEX to do this. My results are very inconsistent.  Is there anyway I can do this through SQL.  I don't have an application to do this for me.  I am trying to get this for a report that is needed. The text field has […]
Merging sql and excel - I’m trying to merge sql data and excel data to an excel spreadsheet. Is there a way to do this?
General Cloud Computing Questions
What exactly is cloud computing? - Is this idea that I have correct: Cloud computing is a place in some company that is offering cloud computing where it has some servers there that are shared among applications that are subscribed to this cloud. For example BAAS, uses cloud computing where the company example google offers some services like push notification/storage/database instead […]
General
what is a good web dev project for a beginner? - So my questions is what is a project for a beginner like me who knows python (very well), C and C++ (comfortable with it), algorithms and datastructuresbut knows nothing about JS HTML CSS and databases. I saw that common suggestion is to create a blog but it seems kind of boring (tho I will start […]
SQLServerCentral.com Website Issues
Airline posts?!? - What's the deal w/ the sudden spate of airline spam posts? Any way to block these systematically?
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -