Azure-Sql-Db

SDU Tools: Script Database Object Permissions in SQL Server T-SQL

SDU Tools: Script Database Object Permissions in SQL Server T-SQL

As part of our free SDU Tools for developers and DBAs, we have many scripting functions. Moving or recreating object-level permissions between SQL Server databases can be time consuming.  To allow scripting these out, we’ve added a tool called ScriptDatabaseObjectPermissions.

It’s a stored procedure (as it has to change databases) and takes a single parameter: @DatabaseName (sysname) as the name of the database whose object permissions you want to script.

2020-01-15

SDU Tools: Version 17 shipped recently to SDU Insiders

SDU Tools: Version 17 shipped recently to SDU Insiders

Version 17 of our SDU Tools shipped out to all our SDU Insiders a few days ago.

It contains the following updates:

DatesInPeriod - Produces a table of dates from a starting date, for a number of intervals. For example, 3 weeks of dates from a starting date.

ServerMaximumDBCompatibilityLevel - Returns the maximum database compatibility level supported by the server.

SetDatabaseCompabilityForAllDatabasesToMaximum​ - Sets the database compatibility level of all databases to the maximum value supported by the server.

2020-01-08

SDU Tools: Script User Defined Database Role Permissions in SQL Server

SDU Tools: Script User Defined Database Role Permissions in SQL Server

As part of our free SDU Tools for developers and DBAs, we have many scripting functions. SQL Server allows you to create your own database roles, and generally, you should do this instead of using the fixed database roles like db_owner, or db_datareader and db_datawriter, as it lets you allocate just the required permissions. To allow scripting out the permissions assigned to these roles, we’ve added a tool called ScriptUserDefinedDatabaseRolePermissions.

2020-01-01

SDU Tools: Script User Defined Server Role Permissions in SQL Server

SDU Tools: Script User Defined Server Role Permissions in SQL Server

As part of our free SDU Tools for developers and DBAs, we have many scripting functions. SQL Server allows you to create your own server roles, and generally, you should do this instead of using the fixed server roles, as it lets you allocate just the required permissions. To allow scripting the permissions that have been assigned to the roles, we’ve added a tool called ScriptUserDefinedServerRolePermissions.

It’s a function and doesn’t require any parameters.

2019-12-18

SDU Tools: Script User Defined Server Roles in SQL Server

SDU Tools: Script User Defined Server Roles in SQL Server

As part of our free SDU Tools for developers and DBAs, we have many scripting functions. SQL Server allows you to create your own server roles, and generally, you should do this instead of using the fixed server roles, as it lets you allocate just the required permissions. To allow scripting these out, we’ve added a tool called ScriptUserDefinedServerRoles.

It’s a function and doesn’t require any parameters.

You can use our tools as a set or as a great example of how to write functions like these.

2019-12-11

SDU Tools: Checking the version of SQL Server (by name) in T-SQL

SDU Tools: Checking the version of SQL Server (by name) in T-SQL

We’re pleased to see that there are now a large number of people using our free SDU Tools for developers and DBAs, and that number grows every day. One of the surprising requests that we’ve constantly received is for something that simply shows the name SQL Server version.

We’ve seen people doing quite messy things to derive the name, like parsing the return value from @@VERSION and so on.

So we decided to make that easy.

2019-12-04

SDU Tools: Check Instant File Initialization (IFI) State for SQL Server

SDU Tools: Check Instant File Initialization (IFI) State for SQL Server

When SQL Server requests storage space from the operating system, the default action is for the OS to write zeroes over all the space before it’s presented to SQL Server to use. This is to ensure that the SQL Server process cannot read the data that was previously on that section of the storage (drive).

This can cause significant delays in at least two common situations:

  • A file needs to grow
  • Space needs to be preallocated during a database restore.

If this security issue isn’t a concern for you (if you have a dedicated SQL Server system, or you have a corporate SAN then it’s unlikely to be), then SQL Server has an option called Instant File Initialization that avoids all the writing of zeroes.

2019-11-27

SDU Tools: Truncate trailing zeroes in SQL Server T-SQL

Often when I convert a decimal number to a string in T-SQL, I want the simplest version of the number. I really don’t want any trailing zeroes (i.e. at the end of the number).

In our free SDU Tools for developers and DBAs, we added a function to do just that: TruncateTrailingZeroes.

The function just takes one parameter: the number to be processed.

You can use our tools as a set or as a great example of how to write functions like these.

2019-11-20

SDU Tools: Single space words in SQL Server T-SQL

SDU Tools: Single space words in SQL Server T-SQL

We’ve got a lot of very useful string-related functions in SDU Tools. This is another one. At times, there’s a need to remove excess spaces between words in strings. In our free SDU Tools for developers and DBAs, we added a function to do just that: SingleSpaceWords.

The function just takes one parameter: the string to be processed.

Find out more

You can see it in action in the main image above, and in the video here:

2019-11-13

SDU Tools: SQL Server SDU Tools Version

SDU Tools: SQL Server SDU Tools Version

More and more users of SDU Tools are adding the deployment of the tools into their standard deployment pipelines, and into their standard operating environments (SOEs).

One common but simple request that we’ve had is that they need to be able to check which version of SDU Tools is currently installed. So we added a function to do that.

It doesn’t take any parameters but just returns the version number as a string.

2019-11-06