| A community of more than 1,600,000 database professionals and growing |
| | Is PowerShell Intimidating? Today we have a guest editorial from Andy Warren as Steve is away on vacation. I was recently speaking with a DBA about what areas we were each targeting for career skills. I have been doing some PowerShell learning and mentioned that. He replied that “PowerShell intimidates me”. Honest and courageous to say, in my view. I was thinking afterward that I bet many of us had similar thoughts, and it was worth exploring more. Why have so many of us been slow to invest time in learning PowerShell? Why have I been so slow to do so? Looking back, I didn’t pay much attention to the launch of PowerShell. It felt at the time like typical Microsoft hyperbole and more than that, it felt like one more thing to learn when I had a whole lot of other learning to do. I think it was hyperbole, but things change. You might think of PowerShell v1 as SQL 7 and PowerShell v3 as SQL 2005. Both were usable, but SQL 2005 was a whole lot more usable. [We’re at PowerShell v5 now] I felt then, and now, that most of the PowerShell advocates didn’t make effective cases for why a DBA would find it valuable to learn. For example, one common theme was that you could use SMO with PowerShell. Interesting if you were using SMO via another language, but not if you weren’t using it at all. We have significant tools at our disposal; a strong scripting(ish) language in T-SQL, SSIS for moving data and files, a configurable, if cumbersome installer for SQL Server. What problem did PowerShell solve better than those? Honest enthusiasm often failed to show DBA’s interesting patterns that they would really use. SQL Server didn’t do PowerShell any favors either. It was ‘baked in’ to SQL 2012, except it was tied to PowerShell v2 and if you wanted to run v3 you had to launch the script from the exe. You could run PowerShell as a job (useful), but SSMS didn’t then, or now, really show a DBA the places and ways that it might make life better and/or more repeatable. PowerShell is built on objects, which makes it both cool and super powerful…if you understand objects, and more so, if you’ve written some code in the .Net world. If you haven’t, well, it’s just more opaque than ever. Just saying “objects” adds a lot of fear to the conversation. It is C#’ish. It has “$” everywhere instead of “@” that we all know is the correct way to indicate a variable. You can write functions, but the use of RETURN is optional and functions return all output, not just the result. You can, if you wish, chain together statement after statement via the pipeline to create a close to un-understandable-one-liner, especially if you use aliases that only the gurus have memorized. All valid, to some degree, but not the real issue. They say that when all you have is a hammer all problems look like nails. Most of our problems are nails and our T-SQL hammer works well for them. If you’re pragmatic about what you learn (and you should be), you have to evaluate whether learning PowerShell is more important than learning anything else, or where it goes on the list. All of those contributed in some way to me not taking time to dig in. Last year learning it finally made it to the top of my list for three reasons; I had time, it felt like a big gap in my game, and I had a small project that seemed liked a good fit. I can’t tell you that learning PowerShell is the right thing for you. I can tell you that if you look past the syntactical differences it’s a nice language. I can tell you that I think learning it to a reasonable degree is a 100 hour investment. I can tell you that being able to say “I know PowerShell” is a nice card to play during an interview, but probably more of a tie-breaker than a job-getter. I can tell you that it’s felt good to learn something new, even if it frustrated me more than once! I shared much of that with my friend, along with this – the few steps up the learning curve are always hard. Feeling reluctant or intimidated is normal, but once you start that doesn’t last long. The trick is deciding to start, and then finding a good book, video, class, or mentor to help get you through that first phase. Editor's note: We have a Stairway to Powershell and the PowerShell Tool Time series here to help you get started. Andy Warren from SQLServerCentral.comJoin the debate, and respond to today's editorial on the forums |
|
| ADVERTISEMENT | | 26 free helpful monitoring ideas for SQL Server Protect yourself from the most common causes of SQL Server pain, with this series of 26 free tips. Covers the hows and whys of monitoring, with practical advice and worked examples. Sign up now. |
| | Have you tried SQL Search yet? SQL Search has one job, and it does it well. Search database schemas for fragments of SQL text in sprocs, functions, views and more. Download Red Gate SQL Search - it's free! |
| | Relieve your database delivery pain points How can you make the delivery of databases more visible, predictable, and measurable? Grant Fritchey explains some of the secrets in this article on database continuous integration. Read now. |
|
|
|
| | | Gregory Larsen from SQLServerCentral.com The APPLY operator allows you to join a record set with a function, and apply the function to every qualifying row of the table (or view). The APPLY operator takes on two formats: CROSS APPLY, or OUTER APPLY. This article will explain the differences between these two formats, and show you examples of how each of these formats work. More » |
| Additional Articles from MSSQLTips.com The SSIS Script Task allows you to add functionality to your SSIS package that does not already exist with the other predefined tasks. In this article, Daniel Calbimonte looks at how to get started using the SSIS Script Task with a few examples. More » |
| Press Release from Redgate Resilient T-SQL code is code that is designed to last, and to be safely reused by others. The goal of defensive database programming, the goal of this book, is to help you to produce resilient T-SQL code that robustly and gracefully handles cases of unintended use, and is resilient to common changes to the database environment. More » |
| Colleen M. Morrow from SQLServerCentral Blogs SQL Server Service Broker is a messaging technology that’s baked right into the SQL Server engine. It was first introduced... More » |
|
|
| | Today's Question (by Steve Jones): If I run this: SELECT TRY_CONVERT(XML, 1) I get an error. What is returned when I run this? SELECT TRY_CONVERT(XML, '1') |
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: TRY_CONVERT(). 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 | Professional Microsoft SQL Server 2014 Integration Services The 2014 release of Microsoft's SQL Server Integration Services provides enhancements for managing extraction, transformation, and load operations, plus expanded in-memory capabilities, improved disaster recovery, increased scalability, and much more. The increased functionality will streamline your ETL processes and smooth out your workflow, but the catch is that your workflow must change. New tools come with new best practices, and Professional Microsoft SQL Server 2014 Integration Services will keep you ahead of the curve. SQL Server MVP Brian Knight is the most respected name in the business, and your ultimate guide to navigating the changes to use Microsoft SQL Server Integration Services 2014 to your utmost advantage. Get your copy from Amazon today. | | |
|
|
|
|
|
| Yesterday's Question of the Day |
| Yesterday's Question (by Peter McLean): What happens when running the following script? CREATE TABLE dbo.PkTest ( NameVARCHAR(5) NOT NULL ) INSERT INTO dbo.PkTest (Name) VALUES('A1234') INSERT INTO dbo.PkTest (Name) VALUES('A123 ') INSERT INTO dbo.PkTest (Name) VALUES('A123') SELECTDISTINCT Name FROMdbo.PkTest ALTER TABLE dbo.PkTest ADD CONSTRAINT [PK_PkTest] PRIMARY KEY CLUSTERED (Name) Answer: 2 rows are returned, but errors due to duplicate key Explanation: Unique constraints on strings pad with trailing spaces when comparing values. Although 'A123 ' and 'A123' are not exactly the same, the SQL-92 specification requires padding of character strings used in comparison, so that thei lenghts match. This results in 'A123' being treated as 'A123 ' and therefore matches an existing row in the table, hence why the primary key cannot be created. Ref: MSKB-https://support.microsoft.com/en-us/kb/316626 » Discuss this question and answer on the forums |
|
|
| | Shane Clarke from SQLServerCentral.com SELECT [dbo].[fn_TxtAge]('1969-01-05 10:30:20',getdate()) -- or select name, [dbo].[fn_TxtAge] (crdate, getdate())as Age fromsysobjects More » |
|
|
| Database Pros Who Need Your Help |
| Here's a few of the new posts today on the forums. To see more, visit the forums. Restore a database with TimeStamp that changes everyday - Hi, I have a Prod Server with multiple databases. I copy all the databases to DR box overnight. I need to... DBA Service - Hello All, We currently do not have an on premise DBA we have a DBA Service that monitors our Databases... SSIS on a dedicated server? - We have a data warehouse SQL server and it has a lot of ETL SSIS running nightly on the server... Selecting data from GUI in msdb - Hi, When I right click and tried to select top 1000 from msdb. This option is not highlighted. Any idea? SQL 2014 Standard... SQL Server Mount Points - Hi, What do you think about using mount points for SQL Server? Is there a performance difference between using a mount... Creating Combined Queries - Hello Help forum, [code]SELECT vend_id, prod_id, prod_price FROM products WHERE prod_price <=5 UNION SELECT vend_id, prod_id, prod_price FROM products WHERE vend_id IN (1001, 1002);[/code] [code]SELECT vend_id, prod_id, pro_price FROM... SSMS connecting to SSIS with message Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc) - Hi Full message below but basically I have tried all the DCOM things in this article and still no joy https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8833d78b-a4c9-4743-ad0b-a3d17bdd3598/connecting-to-ssis-through-ssms-without-built-in-administrator?forum=sqlsetupandupgrade Using... Error in dynamic sql - Hi i am getting error when i am running this query. Msg 102, Level 15, State 1, Line 7 Remove/Keep record based on group - Hi, I have the following data: declare @Policy table ( Download varchar(20), AccountNum varchar(20), RootPolicyNum varchar(20), PolicyNum varchar(20), CurrentStatus varchar(20) ) insert into @Policy (Download, AccountNum, RootPolicyNum, PolicyNum, CurrentStatus) select 'EQAutralia',... sql commands in a job - hi i want to run in a job the following SQL commands update Reports set SSIS=1 where ReportID=50 EXEC msdb.dbo.sp_start_job N'D_Reports' update Reports set... Recurring deadlocks - I've been having recurring and continue deadlocks due an store procedure with this code: [code="sql"] --UPDATE t1 -- SET Invalid = 1 --FROM dbo.Table1 t1 -- INNER... Need help on getting last day of the months in seconds for 13 months - I wrote the query and it returned the results only on the 28th of each month. [code="sql"] With cteMonths as ( select DATEADD(s, -1,... sql and stored procedure - How can I return select @@servername along with the result of this stored procedure - msdb.dbo.sp_get_sqlagent_properties in a single row. Result : Servername1,all columns... Tlog file full..No space to ru Backup log statement - Good morning Experts, Transaction log file is full. I cannot even issue backup log command as there is no space at... How to find out what databases have not being used for a year - Hello, I started working in a company where we have 6 production servers with a lot of databases on each... Varchar usage - Hi All, My understanding of varchar data type is that it reserves only the size of actual data stored in it. For... Log files will not Shrink: - hi I have inherited some dbs that all have the same logical name for database and log file, which I am... Drop failed for jobs - I have a problem with some jobs, disabled since not useful, which I cannot drop. The message returned is TITLE:... SQL backup best practices - For taking db/tran log backups which one to be used as a best practice: 1. Using database maintenance plans 2. Using sql/stored... Search for hyphen in database: it does not find the hyphen? - I am doing a data cleansing activity. The original Source was in Access Database Current Source in SQL Server 2008 R2 nvarchar(50) The... |
|
| 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 ©2015 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. Contact: [email protected] |
|
|