Category: SQL Tips

Tips to help you with SQL

SQL Tips – Identifying which version of SQL Server you are using

If you need to find out the version of SQL Server you are using, simply use the following script: SELECT SERVERPROPERTY(’productversion’), SERVERPROPERTY(’productlevel’), SERVERPROPERTY(’edition’)SELECT SERVERPROPERTY(‘productversion’), SERVERPROPERTY(‘productlevel’), SERVERPROPERTY(‘edition’)

Posted in SQL Tips, Tips

SQL Tips – List of Top Level Domains

Here is SQL and a text list of the Top Level Domains currently in use on the internet The list is free for all to use for any purpose. The original data was sourced from IANA on Thursday 5 February

Posted in SQL Tips, Tips

SQL Tips – List of New Zealand Towns and Cities

Here is SQL and a text list of the towns and cities in New Zealand. The list is free for all to use for any purpose. The original data was sourced from Wikipedia on Saturday 31 January 2008. If you

Posted in SQL Tips, Tips

SHA256 and higher in SQL Server

As part of a new project I’m doing, I needed to use hashes. A good source of information on hashes is available from wikipedia. SQL has the built in function HASHBYTES but this only supports up to the SHA128 algorithm

Posted in C# Tips, SQL Tips, Tips

SQL Tips – List of US States

Here is SQL and a tab delimited list of the States of the USA for all to use. The original data was sourced from Wikipedia. Please post a comment if you find this useful. Edit: I’ve beed advised that although

Posted in SQL Tips, Tips

SQL Tips – List of Countries

Here is SQL and a tab delimited list of Countries for all to use. The original data was sourced from Wikipedia. Note that some countries have single quotes in their names, these need to be escaped for SQL. The SQL

Posted in SQL Tips, Tips

SQL Tips – List of International Dialling Codes (IDC's)

I’ve been working on a new project and needed a list of International Dialling Codes to insert into my database. Here are the results of my work for all to use. The list is supplied as SQL and then tab

Posted in SQL Tips, Tips

SQL Tips – Saving Changes Not Permitted

If you’re new to SQL 2008, you’ve probably seen the following message: The error reads: Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to

Posted in SQL Tips, Tips

SQL Performance – Using LOWER() on case insensitive collations

Take a look at the following SQL. SELECT firstName, lastName FROM tUsers WHERE LOWER(firstName) = ‘john’SELECT firstName, lastName FROM tUsers WHERE LOWER(firstName) = ‘john’ The above SQL is Syntactically correct. But, and this is a big but, unless you are

Posted in SQL Tips, Tips

SQL Joins and Applies – Understanding APPLY

This is part of a four part post series on SQL Joins and Applies. If you want to follow the examples given, you can get the T-SQL to create the tables, function and test data from my earlier post SQL

Posted in SQL Tips, Tips