How to Make Sense of SQL Server Geography Data Type

Total: 2 Average: 5

SQL Server Geography data type is unlike other types simply because you don’t use it often. It’s not like varcharintfloat, or DateTime present in every table, at least in one type.

Do we need the SQL Server Geography data type? To make sense of something new, we need to answer three fundamental questions:

What problems does it solve? The answer lies in use cases.
What are the things involved in studying it? You will learn a few basic definitions and acronyms. I collected only the important stuff, so it won’t bore you.
Are there examples to further explain how it works and is it easy to implement? Our kind lives with code. We eat and sleep with it. So, we’re going to have sample codes in this post.

Read More

How to Use SQL Server HierarchyID Through Easy Examples

Total: 4 Average: 5

Do you still hold on to the parent/child design, or would like to try something new, like SQL Server hierarchyID? Well, it is really new because hierarchyID has been a part of SQL Server since 2008. Of course, the novelty itself is not a persuasive argument. But note that Microsoft added this feature to represent one-to-many relationships with multiple levels in a better way.

You may wonder what difference it makes and which benefits you get from using hierarchyID instead of the usual parent/child relationships. If you never explored this option, it might be surprising for you.

Read More

The Easy Guide on How to Use Subqueries in SQL Server

Total: 5 Average: 5

Do you use SQL subqueries or avoid using them?

Let’s say the chief credit and collections officer asks you to list down the names of people, their unpaid balances per month, and the current running balance and wants you to import this data array into Excel. The purpose is to analyze the data and come up with an offer making payments lighter to mitigate the effects of the COVID19 pandemic.

Do you opt to use a query and a nested subquery or a join? What decision will you make?

Read More

7 Facts About SQL Server Synonyms You Should Know

Total: 6 Average: 5

Before SQL Server Synonyms appeared, everyone wished to simplify and enhance their database experience.

Imagine you have an application with a database that references another database from the same server. Then, a major reorganization forces your team to transfer the other database to another server.

There is no doubt your application will break. But what will you do in that case? Link the 2 servers and hardcode all the references (again) to point to the new server?

Read More