-->
SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

SQL DBA With A Beard

Rob is a SQL Server DBA currently supporting several hundred databases ranging from SQL 2000 to SQL 2012. Rob has a fabulous beard and loves to use Powershell to make his life easier.

Archives: April 2017

PowerShell Function – Validating a Parameter Depending On A Previous Parameter’s Value

I was chatting on the SQL Community Slack with my friend Sander Stad b | t about some functions he is writing for the amazing PowerShell SQL Server Community module dbatools. He was asking my opinion as to how to enable user choice or options for Agent Schedules and… Read more

0 comments, 231 reads

Posted in SQL DBA With A Beard on 26 April 2017

Setting the default file type for a new file in VS Code

Just a short post today. When you open a new file in VS Code (Using CTRL + N) it opens by default as a plain text file.

To change the language for the file use CTRL +K, M.

That’s CTRL and K together and then M afterwards separately.

then you… Read more

1 comments, 573 reads

Posted in SQL DBA With A Beard on 24 April 2017

Using Twitter with VS Code

So today I saw this tweet from Mathias in reply to Stefan and Amanda

 

That looks cool. Twitter in VS Code, one less programme to open Here how it works

Open VS Code and hit CTRL + P and type ext install twitter or hit CTRL + SHIFT +… Read more

0 comments, 755 reads

Posted in SQL DBA With A Beard on 19 April 2017

Why VS Code Increases my Productivity

Last week I was showing a co-worker some PowerShell code and he asked what the editor was that I was using. Visual Studio Code I said. Why do you use that? What does it do?

This is what I showed him

Runs on any Operating System

Code (as I shall… Read more

5 comments, 259 reads

Posted in SQL DBA With A Beard on 13 April 2017

Why Volunteer at SQLBits ?

WARNING – Contains Orange and light-hearted photos

I have returned home from SQLBits 2017 The Disco Edition. I am exhausted, my body is pointing out to me in a variety of ways that this is the only week of the year that I spend so much time on my feet.… Read more

3 comments, 304 reads

Posted in SQL DBA With A Beard on 11 April 2017

Export SQL User Permissions to T-SQL script using PowerShell and dbatools

There are times when DBA’s are required to export database user permissions to a file. This may be for a number of reasons. Maybe for DR purposes, for auditing, for transfer to another database or instance. Sometimes we need to create a new user with the same permissions as another… Read more

0 comments, 554 reads

Posted in SQL DBA With A Beard on 10 April 2017

Testing SQL Server Access to a share with PowerShell using dbatools

A good security practice is to backup our SQL Servers to a network share but not allow users to be able to browse the share. How can we ensure that our SQL Server has access or test it if it has been set up by someone else?

Lets set this… Read more

0 comments, 882 reads

Posted in SQL DBA With A Beard on 8 April 2017

Testing the Identity Column usage in SQL Server with PowerShell and dbatools

SQL Server uses identity columns to auto generate values, normally keys. When you create an identity column, it has a data type and that data type has a maximum number of values.

  • BigInt 9,223,372,036,854,775,808
  • Int 2,147,483,647
  • SmallInt 32,767
  • tinyint 255

What happens when you try to insert a value in… Read more

1 comments, 333 reads

Posted in SQL DBA With A Beard on 7 April 2017

Using Pester with Get-DbaLastGoodCheckDb from dbatools

In my last post I showed Get-DbaLastGoodCheckDb  from dbatools. This module is a community based project written by excellent, brilliant people in their own time and available to you free. To find out more and how to use and install it visit https://dbatools.io

In a similar fashion to my post… Read more

0 comments, 281 reads

Posted in SQL DBA With A Beard on 6 April 2017

Getting SQLServers Last Known Good DBCC Checkdb with PowerShell and dbatools

As good SQL Server DBA’s we want to ensure that our databases are regularly checked for consistency by running DBCC CheckDB. This will be frequently scheduled using an Agent Job or by using Ola Hallengrens Maintenance Solution

We can check for the last known good DBCC Check using the undocumented… Read more

1 comments, 298 reads

Posted in SQL DBA With A Beard on 5 April 2017

Test the SQL Server database collation with PowerShell and dbatools

If your server collation is different to your database collation then you may find that you get an error similar to this

Cannot resolve the collation conflict between “SQL_Latin1_General_CP1_CI_AS” and “Latin1_General_CI_AS” in the equal to operation.

when your queries use the tempdb

It would be useful to be able to… Read more

0 comments, 243 reads

Posted in SQL DBA With A Beard on 3 April 2017

Max Length of a column in a DataTable in PowerShell

Whilst I was writing my Test-DbaLastBackup Posts I ran into a common error I get when importing datatables into a database

I was using this table

and when I tried to add the results of the Test-DbaLastBackup I got this

Exception calling “WriteToServer” with “1” argument(s): “The given value of…

Read more

0 comments, 305 reads

Posted in SQL DBA With A Beard on 1 April 2017