Foto%20quadrada%20per%20silvrback_large

Josep

Get-Hash, a powershell hash function

I needed a hash function that I could pass a text string or a file to compute its hash (MD5, SHA1, etc…). But unfortunately Powershell hasn’t got one, so I started to look for alternatives:

Read More

April 20, 2016

Remove IDENTITY property from a primary key column in SQL Server

When there’s a table with a primary key that is an IDENTITY and you want to remove the IDENTITY property, there’s no simple SQL code to do it. It is not a trivial task. In fact, there’re many steps to be done and it’s better to do all of them inside a single transaction, to avoid to leave the database in a inconsistent way (without FK, or . . .

Read More

April 20, 2016

Get SQL Server user permissions

I’ve found three ways of getting user permissions (grants and denies) in SQL Server:

  • SQL Server Management Studio: It’s OK and user-friendly. But it’s not an option if you’ve a large farm of servers or you want to script it and create task to run the checks.
  • Impersonate as the user and check its permissions.
  • SELECT on . . .

Read More

April 19, 2016

RAID controller got frozen

Why it's important to buy a good RAID controller

I write this post to explain a problem I found with a RAID controller. One morning I was notified that PostgreSQL in one development server was stopped. I connected to it and I found the service stopped. It was a physical server running Windows Server 2008 R2 and PostgreSQL 9.0. The server had a RAID 1. It’s important to notice that Windows . . .

Read More

April 19, 2016

Install Pyrseas in Windows 64bits

Pyrseas is a Database Version Control for PostgreSQL with a very interesting approach and with an easy way to script a database (database to a YAML file) and to apply changes to a database (YAML file to a database). It’s develped in Python by Joe Abbate (thank you Joe for it!)

Currently I’m using dbtoyaml to script the database in . . .

Read More

April 19, 2016

Explicit date format conversions

Don't let it to the system configuration

Implicit date format conversions, when no format is specified, are always a source of troubles when:

  • Passing dates as parameters in scripts to databases, other scripts, applications, web services or other targets, because each system is waiting the dates in specific format.
  • Running a SQL script in databases with different . . .

Read More

April 19, 2016

Clean coding with Write-Verbose

It’s a good practise to use the Write-Verbose,Write-Debug and other about_CommonParameters when writing functions because it helps you to write clean code in a very integrated way with Powershell. One of its main benefits is for debugging and verbosing without needing to modify your code.

I’ll focus on the usage of Write-Verbose. The . . .

Read More

April 19, 2016

Archive