In this post, I will cover three features in Sql Server Database
Tools that you might not know about, but are real time savers.
1 – Refactor:
In SSDT, refactoring allows you to quickly and accurately
deal with renaming objects or moving them to new schemas. There is also another refactor feature
called, Fully-Qualify Names, which allows you to quickly add prefixes to your
columns in a query. This makes for much
easier reading and cleaner code. Imagine
we have a query with a few joins like this:
from [dbo].[FactInternetSales] s
join [dbo].[DimDate] d on s.ShipDateKey = d.DateKey
join [dbo].[DimCustomer] c on s.CustomerKey = c.CustomerKey
If I right click anywhere in the query and select
Refactor> Fully-Qualify Names, it will bring up a dialogue like this:
Apply will make the changes shown in the preview.
Suppose we are editing the view that we just created and we
wanted to see more details about the First Name column – what is the maximum
length, is there a default, is it included in any indexes? We can easily do this, by right clicking on
the column and selecting “Go to Definition.”
This will pop open the definition of the table in a new tab,
bringing the cursor right to the line in question and allowing us to see those
Now, suppose we want to find out all the places that use
FirstName in our database code. From the
table script, we can click on “Find All References” and it will open a new
window called “Find Symbol Results,” which will list a line for each reference
in our entire database:
Clicking on a result, opens that script and brings your right
to the line where it is referenced.
I hope these tips can help your workflow become more efficient.