-Поиск по дневнику

Поиск сообщений в rss_sqlblogcasts

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 01.11.2007
Записей:
Комментариев:
Написано: 1

SQL Server Blogs





Voices from the UK SQL Server Community


Добавить любой RSS - источник (включая журнал LiveJournal) в свою ленту друзей вы можете на странице синдикации.

Исходная информация - http://sqlblogcasts.com/blogs/default.aspx.
Данный дневник сформирован из открытого RSS-источника по адресу http://sqlblogcasts.com/blogs/mainfeed.aspx, и дополняется в соответствии с дополнением данного источника. Он может не соответствовать содержимому оригинальной страницы. Трансляция создана автоматически по запросу читателей этой RSS ленты.
По всем вопросам о работе данного сервиса обращаться со страницы контактной информации.

[Обновить трансляцию]

SQL 2016 Technical Deep Dive Video – Tooling

Понедельник, 14 Марта 2016 г. 13:00 + в цитатник
This is the set of videos from the SQL Server Engineering Team on SQL Server 2016. This post is covering Tooling. For the other groups of videos have a look at. Customer Stories And End To End Implementations Azure Big Data and Analytics BI, integration and reporting SQL Engine and TSQL Upgrade Tooling Videos on You tube. Tooling Improvements in SQL Server 2016 Ken Van Hyning ( LinkedIn ) and Kevin Cunnane ( LinkedIn | Twitter ) On this Data Driven session, we'll go over a brief overview of new...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/14/sql-2016-technical-deep-dive-video-tooling.aspx


Метки:  

SQL 2016 Technical Deep Dive Video – Tooling

Понедельник, 14 Марта 2016 г. 13:00 + в цитатник
This is the set of videos from the SQL Server Engineering Team on SQL Server 2016. This post is covering Tooling. For the other groups of videos have a look at. Customer Stories And End To End Implementations Azure Big Data and Analytics BI, integration and reporting SQL Engine and TSQL Upgrade Tooling Videos on You tube. Tooling Improvements in SQL Server 2016 Ken Van Hyning ( LinkedIn ) and Kevin Cunnane ( LinkedIn | Twitter ) On this Data Driven session, we'll go over a brief overview of new...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/14/sql-2016-technical-deep-dive-video-tooling.aspx


Метки:  

SQL 2016 Technical Deep Dive Video – Tooling

Понедельник, 14 Марта 2016 г. 13:00 + в цитатник
This is the set of videos from the SQL Server Engineering Team on SQL Server 2016. This post is covering Tooling. For the other groups of videos have a look at. Customer Stories And End To End Implementations Azure Big Data and Analytics BI, integration and reporting SQL Engine and TSQL Upgrade Tooling Videos on You tube. Tooling Improvements in SQL Server 2016 Ken Van Hyning ( LinkedIn ) and Kevin Cunnane ( LinkedIn | Twitter ) On this Data Driven session, we'll go over a brief overview of new...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/14/sql-2016-technical-deep-dive-video-tooling.aspx


Метки:  

SQL 2016 Technical Deep Dive Video – Summary of all Videos

Понедельник, 14 Марта 2016 г. 12:00 + в цитатник
Did you watch the launch event on the 10th and walk away a little short changed. Well that’s because there is so much awesome new stuff in SQL 2016 that you couldn’t really give them all enough air time to really show them in the detail you want. The great news is that the SQL Team have done a whole set of videos that go into the detail of the new features in SQL 2016 The whole list can be found here SQL Server Data Driven- Technical Deep Dive or you can look at the lists in the following groupings...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/14/sql-2016-technical-deep-dive-video-summary-of-all-videos.aspx


Метки:  

SQL 2016 Technical Deep Dive Video – Summary of all Videos

Понедельник, 14 Марта 2016 г. 12:00 + в цитатник
Did you watch the launch event on the 10th and walk away a little short changed. Well that’s because there is so much awesome new stuff in SQL 2016 that you couldn’t really give them all enough air time to really show them in the detail you want. The great news is that the SQL Team have done a whole set of videos that go into the detail of the new features in SQL 2016 The whole list can be found here SQL Server Data Driven- Technical Deep Dive or you can look at the lists in the following groupings...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/14/sql-2016-technical-deep-dive-video-summary-of-all-videos.aspx


Метки:  

SQL 2016 Technical Deep Dive Video – Summary of all Videos

Понедельник, 14 Марта 2016 г. 12:00 + в цитатник
Did you watch the launch event on the 10th and walk away a little short changed. Well that’s because there is so much awesome new stuff in SQL 2016 that you couldn’t really give them all enough air time to really show them in the detail you want. The great news is that the SQL Team have done a whole set of videos that go into the detail of the new features in SQL 2016 The whole list can be found here SQL Server Data Driven- Technical Deep Dive or you can look at the lists in the following groupings...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/14/sql-2016-technical-deep-dive-video-summary-of-all-videos.aspx


Метки:  

Fancy seeing inside of the SQL Server team

Суббота, 12 Марта 2016 г. 16:38 + в цитатник
The Database Systems team that build SQL Server , SQL Azure, SQL Data Warehouse and recently have ported SQL to run on linux, are running an open house next week. https://www.eventbrite.com/e/microsoft-database-systems-engineering-open-house-registration-22670879210 Its still not too late to register, whether you are looking for a new challenge or just want to meet and discuss whats going on. Why not register, maybe you could be helping to deliver SQL Server on Linux. https://www.eventbrite.com/e...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/12/fancy-seeing-inside-of-the-sql-server-team.aspx


Awesome series on SQL Server clustered column store (operational analytics)

Четверг, 10 Марта 2016 г. 00:59 + в цитатник
  Sunil Agarwal Principal Program Manager on the SQL Server team I’ve just been made aware of an awesome series of blog posts from Sunil,   Real Time Operational Analytics · real-time-operational-analytics-using-in-memory-technology/ · real-time-operational-analytics-using-nonclustered-columnstore-index/ · real-time-operational-analytics-simple-example-using-nonclustered-clustered-columnstore-index-ncci/ · real-time-operational-analytics-dml-operations-and-nonclustered-columnstore-index...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/09/awesome-series-on-sql-server-clustered-column-store-operational-analytics.aspx


Are you prepared to be blown away

Вторник, 08 Марта 2016 г. 15:37 + в цитатник
So yesterday we got told that SQL Server will run on linux don’t forget to sign up https://www.microsoft.com/en-us/server-cloud/sql-server-on-linux.aspx   My interest is that if thats what we get told with two days to go before the big event on the 10th March https://www.microsoft.com/en-us/server-cloud/data-driven.aspx , what else do you think is coming?   Are you prepared to be blown away [Updated:8 March 2016 with number 2 days to go]...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/08/are-you-prepared-to-be-blown-away.aspx


Managing multiple accounts in PowerBI

Вторник, 08 Марта 2016 г. 15:28 + в цитатник
As a consultant I have multiple clients with different PowerBI setups. I would love an easy way to switch between all the organisations. As it is I have to signout and sign back in every time I want to switch, or setup different browsers. Its a real pain.   It would be lovely to have either an easy way to switch or an easy way to have multiple PowerBI sessions open, with different logins. This is my suggestion for easy switching of logins. https://ideas.powerbi.com/forums/265200-power-bi-ideas...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/08/managing-multiple-acocunts-in-powerbi.aspx


Метки:  

Its not April Fools Day–SQL will run on Linux

Вторник, 08 Марта 2016 г. 03:05 + в цитатник
It just does to show that Steve Jones doesn’t have a time machine. 11 years ago Steve wrote about SQL Server being ported to run on Linux http://www.sqlservercentral.com/articles/The+Lighter+Side/sqlserveronlinux/1814/ Well today its been announced as true. https://blogs.microsoft.com/blog/2016/03/07/announcing-sql-server-on-linux/   What does that mean for you normal SQL folks? Probably not much, except it makes your skills much more attractive now than they ever were.   What it does mean...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2016/03/08/its-not-april-fools-day-sql-will-run-on-linux.aspx


Microsoft deliver on their promises, handsomely!

Пятница, 18 Декабря 2015 г. 13:13 + в цитатник

At the SQL PASS Summit in October, James Phillips made a promise that everything he talked about or demonstrated in his keynote would be available by the end of the year.  Well they have delivered, handsomely! 

Today SQL Server 2016 CTP3.2 has been made available which delivers mobile reporting to SQL Server Reporting Services (SSRS).  SSRS has been ignored by Microsoft for years as James Phillips acknowledges in his keynote, but today SSRS gets a complete makeover and lots of new features including the integration of the Datazen mobile technology (screenshot below).  About time on-premise reporting got a makeover!

SSRS_MobileSupport

Report Manager’s new web portal also provides support for Key Performance Indicators (KPIs), which starts taking Report Manager into the realms of the dashboard arena. 

7142.clip_image0064_thumb1_thumb_6FDCC4EC

The December update to Power BI desktop includes the ability to include R visualisations into your dashboards (screenshot below).  R is an exciting development for BI professionals as it allows them to deliver practical tools to data scientists who are a demanding and extremely well educated community of end-users, very familiar with the tools and techniques required to big data analysis.  SQL Server 2016 includes R services, so Microsoft are only a small step away from delivering an end-to-end R solution with both the massively parallel data querying to the visualisations.  If you missed it, it is well worth watching Jason Wilcox PASS Summit presentation on The Future of Analytics

image

Power BI’s SSAS multidimensional support just got better to, with the introduction of support for hierarchies.  Power BI is really galvanising renewed interest in SSAS multidimensional as it is one of the best ways of implementing a user specific dashboard where different users use the same dashboard, but see their own data. I am working on this scenario at the moment for one client where different manages in the firm get to see their own team’s sales data and statistics.  The infrastructure to support this scenario is the newly announced Power BI Enterprise Gateway and the existing Azure Active Directory which provides single sign-on (SSO) access to thousands of cloud SaaS Applications like Office365, Salesforce, DropBox and Google Apps.

Power BI desktop also gets tighter control of formatting and many enhancements to various visualisations.  I love the new Format Painter! Take a look at the release video here.

Microsoft also announced the Data Insights Summit will take place in Bellevue, WA in March.  Maybe worth a trip!

Right, time to install CTP3.2 and get cracking on that mobile BI demo

http://sqlblogcasts.com/blogs/drjohn/archive/2015/12/18/microsoft-deliver-on-their-promises-handsomely.aspx


Continuous Integration and the Data Warehouse

Вторник, 01 Декабря 2015 г. 10:42 + в цитатник

SQLSaturdaySouthamptonI am excited to say that over the next two weekends I am speaking at PASS SQL Saturday events in Southampton and Slovenia on Continuous Integration and the Data Warehouse.  Over the coming weeks I hope to provide some supporting posts outlining exactly how to set up CI in the data warehouse context.  However, I am taking a new contract next week, so my time may be sparse!

In my view, the key to implementing Continuous Integration is to move away from the old migration-based development of your SQL database to the declarative model approach offered by SQL Server Data Tools (SSDT).  In my opinion, without this transition you will be fighting an up-hill battle!

SQL Saturday SloveniaI recently attended a SQL Supper session by Alex Yates of RedGate where he discussed the pros and cons of state-based declarative model versus migration-based database development strategies.  Although he outlines the problems inherent in both approaches, he did not outline how SSDT and good source code management overcomes all these issues as his talk was tool-neutral.  He is also speaking at Southampton, so please go along.

With the declarative model approach, problems typically arise when you:

  1. Add a non-nullable column to an existing table which contains data
  2. Rename an existing column
  3. Two developers change the same objects at the same time one adds a new column to a table and a related proc, and the other developer renames the same table. This is the example Alex uses in his presentation.

I am sure there are a few other scenarios, but none immediately come to mine on this a cold November morning.

SQL Server Data Tools overcomes these issues by the following specific functionalities:

  1. Simply select “smart defaults” when you publish your database.  This will add a new nullable column to the table, then populate it with zeros and finally make it non-nullable.  All automatically!  You can then run your own data fix to update the zeros with the correct values. Clearly on a table containing a large amount of data, populating the new column with zeros will take a long time, so you may want to think about your deployment methodology. 
  2. Use the Refactor-Rename option on the SQL menu; but remember to check in the newly created refactor file!
  3. Of course, when the second developer checks the code into source control, he will be made aware of conflict and will have to merge his changes into the branch. If he does it wrong, SQL Server Data Tools will immediately identify that he broke the related stored proc, particularly when he compiles the project.  Even if he checks in the broken code, your continuous integration environment will pick up the flaw and highlight the broken code.  If you don’t have CI, come and find out how to implement it at my talk!

So please come along to one of my PASS SQL Saturday presentations or watch this space for more on Continuous Integration and the Data Warehouse

http://sqlblogcasts.com/blogs/drjohn/archive/2015/12/01/continuous-integration-and-the-data-warehouse.aspx


Another one bites the dust – cross database queries now possible in SQL Azure

Воскресенье, 18 Октября 2015 г. 21:16 + в цитатник
I’m constantly amazed at the rate at which blockers for adoption for Azure SQL Database are being removed. With the advent of V12 servers we got the same core services as on premise. Since then we’ve got full text, encryption, row level security, transparent data encryption and more. Last week Torsten Grabs blogged about the next big thing which not only enables cross database queries but some other great elastic scale features. You can read about the details here ttps://azure.microsoft.com/en-us...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2015/10/18/another-one-bites-the-dust-cross-database-queries-now-possible-in-sql-azure.aspx


Using SQL Server on high resolution monitors

Четверг, 15 Октября 2015 г. 09:37 + в цитатник
Many people are fortunate enough to have laptops or desktops that enable high resolution displays. If you try and run SQL Server management studio on those displays you will see everything is minute and unreadable.   The solution is to use scaling to increase the size of fonts and other components so you can the fonts and push the buttons. I use 150% on my surface Pro 3 and it works well for most apps. Unfortunately for this to work properly your app needs to handle the scaling correctly. many...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2015/10/15/using-sql-server-on-high-resolution-monitors.aspx


SQL Saturday 467 - Precon - Query processing and internals

Воскресенье, 04 Октября 2015 г. 17:04 + в цитатник

Im not doing a tremendous amount of public speaking this year and concentrating on more professional matters, however im pleased to say that on Friday 5th December i will be presenting a day long pre-con on Query Processing and internals at SQL Saturday 467 in Southampton.

We will be spending the whole day looking at the optimizer and picking apart its internals to show how it generates a plan from your given sql. This will cover a wide range of topics, starting from execution plan basics and working ourselves through to demonstrating internals with undocumented traceflags.

Other precons are available if this doesn't float your boat. Full details, pricing and hotel discount codes are available from http://www.sqlsaturday.com/467/eventhome.aspx

http://sqlblogcasts.com/blogs/sqlandthelike/archive/2015/10/04/sql-saturday-467-precon-query-processing-and-internals.aspx


You are using Office 365 (Business) and you want Office 2016 this is what you need to do

Понедельник, 28 Сентября 2015 г. 11:27 + в цитатник
If you are eager to get office 2016, I would there are some really nice features, you might be wondering how. There is no automated update (that’s coming next year) and if you go to Office 365 and download software you will just get 2013 (the latest ??? go figure) What latest actually means is latest on the branch of office you are configured for. If you want the bleeding edge then you need to say so in the service settings of office 365 To do this Go to the admin section of office 365. Select Service...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2015/09/28/you-are-using-office-365-business-and-you-want-office-2016-this-is-what-you-need-to-do.aspx


Upgraded to Excel 2016 and can’t find PowerView you aren’t alone

Понедельник, 28 Сентября 2015 г. 11:17 + в цитатник
I recently upgrade to Excel 2016 ( read this on how to get it with Office 365 ) and couldn’t for the life of me find PowerView. Power View is included as an add in for excel 2016 and so i assumed like power query that its menu had been consumed into another menu but no couldn’t find it. I checked add-ins and as expected the add-in wasn’t enabled and so I enabled it, but I still couldn’t find it. As it turned out the menu item to insert a Power View sheet is turned off by default and so you need to...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2015/09/28/upgraded-to-excel-2016-and-can-t-find-powerview-you-aren-t-alone.aspx


What is Devops? The power of feedback

Среда, 15 Июля 2015 г. 13:13 + в цитатник
My heart was filled with a little joy today because someone, somewhere in the world updated an item on uservoice. I voted on this uservoice item sometime ago, and today it was updated to say it was started. https://support.powerbi.com/forums/265200-power-bi/suggestions/6897955-open-excel-report-from-power-bi-app Now historically MS and SQL have taken in feedback using connect and some would regard it as the black hole of feedback. The reason being was that 1. There was little focus on small improvements...(read more)

http://sqlblogcasts.com/blogs/simons/archive/2015/07/15/what-is-devops-the-power-of-feedback.aspx


Supercharge your SSDT database projects using T4 to auto-generate T-SQL code!

Среда, 08 Июля 2015 г. 10:06 + в цитатник

There are many techniques that data warehouse developers could learn from other parts of the software industry and automated code generation is one of them. Most database developers have at some point in their careers written T-SQL code to query the SQL Server catalog views to automate the generation of some SQL code. However, such approaches always suffer from the same drawback: they are working with a materialized copy of the database you are developing, not the up-to-the-minute actual code you are working with within SQL Server Data Tools (SSDT).

Introducing Text Template Transformation Toolkit

The Text Template Transformation Toolkit (T4) is easy to overlook because it is baked into the heart of your favourite development tool SQL Server Data Tools (SSDT). First released in Visual Studio 2005, the Text Template Transformation Toolkit has been the standard code-generation technique for all application developers. One of the key reasons T4 has not been widely adopted by the database community is that there are precious few examples out there about using T4 to generate T-SQL code and the official Microsoft documentation uses HTML or C# code generation in all their examples (yuk!). Also when you open Visual Studio, T4 does not jump out and grab you. You need to know where to look.

Why use T4 Templates?

Essentially T4 Templates can be used anywhere in your SSDT project where you need to generate multiple database objects based on other database objects such as tables. In the context of data warehouse development, T4 Templates are particularly useful for generating MERGE statements, triggers and history tables (i.e. tables to record changes to data in other tables).

As an example of their practical use, let’s take a real-world scenario. Many financial institutions have a regulatory requirement to record every change to data that appears in the data warehouse so they know how a report looked like at any point in time. A simple but effective solution to this requirement is to create a set of history tables which have exactly the same structure as the data warehouse dimension or fact table but with an extra column which records the date the data was changed (i.e. the effective date). An update trigger is then created on the source table which populates the history table every time the source table is updated. In this situation two new database objects need to be created for each source table – a history table and a matching update trigger. Of course, these two objects can be created manually, but imagine doing that for 200 source tables; that is 400 objects you need to code by hand! This is where T4 Templates come in. Using a T4 Template containing only a few lines of code, you can easily generate all the history tables or update triggers which are automatically added to your SSDT project as a SQL file. Even better, when you add another source table, you simply run the T4 Template again and it will generate the matching history table and update trigger. This is precisely the scenario I have implemented in the code example provided with this blog.

There are three ways you could implement T4 Templates:

  1. Use ADO.NET to query the SQL Server catalog views on a materialized (deployed) copy of the database
  2. Use the Data-tier Application Framework (DACFx) to query the content of the DACPAC generated by SSDT on your last build
  3. Use the Data-tier Application Framework (DACFx) to query the in-memory content of your SSDT project

The problem with the first two approaches is that the schema is out-of-date, albeit by minutes. You want to be dealing with the code you are developing now. This is why I chose the final method for coding up my T4 Templates provided alongside this post. It gives you access to the in-memory model of your database, not some old out-of-date copy.

Where do T4 Templates appear within SSDT?

The following screenshot of a SSDT solution shows that each T4 Template consists of two objects. The T4 Template itself which has a .tt suffix and the corresponding generated .sql code file which is presented below. The .sql code file generated by the T4 Template becomes part of the solution and will be compiled into your DACPAC when you build. During the build process, the .tt file is ignored – only the generated .sql code file is compiled.

In the example solution, I have placed all the T4 Templates within one folder. The structure is entirely up to you. However, when referencing include files, keeping everything in one folder makes life much easier.

image

So, for each of the 26 dimension and fact tables in the Adventure Works DW database, as per the requirements outlined above, I want to create a set of history tables and matching update triggers using a single T4 Template. So let’s review the code in the HistoryTables.tt T4 Template file.

image

As you can see, the T4 Template mostly consists of T-SQL code with which you are very familiar. The code between the angle brackets is C# code handling the iteration over the database model and returning the names of the objects found. It is a bit like old ASP or modern day BIML. Let’s look at each line of code to see what they are doing.

image

This is a T4 include directive which includes the InMemoryDatabaseModelInclude.tt file which holds the library of common functions I have written which make working with the Data-tier Application Framework (DACFx) much easier.

image

The first thing we do is get a handle on the in-memory database model (i.e. the content of your SSDT project) by calling GetInMemoryDatabaseModel() which is one of the functions I have written as part of the common function library in the include file. This line obtains a reference to the in-memory database model (i.e. the content of your SSDT project) which is held by an instance of the TSqlModel class which is part of the Data-tier Application Framework (DACFx). Note that you should always use a using statement when dealing with a DACFx TSqlModel class as this will automatically dispose of the model and release the resources used once your template has run.

image

The call to GetAllTablesInSchemaWithPrefixes() requests all the tables within the dbo schema which have either the prefix Fact or Dim. In the case of the AdventureWorksDW database, this function returns all 24 dimension and fact tables.

This is the first line of T-SQL where we dynamically create the name of the new table based on the name of the source table, but in the History schema.

image

Next we iterate through the list of columns in the source table which we obtain by a call to the DACFx function GetReferenced() and we then add them into the new table definition by calling the GetColumnDefinition() function which returns a string containing the T-SQL for the column definition.

image

We finish our T-SQL statement by adding a standard column to the table which records when the history table record was written and completing the CREATE TABLE statement by providing a FILEGROUP name upon which all the new history tables will be stored. And that is it! Pretty straight forward and easy to follow. But that is mostly because I have done all the hard work in the InMemoryDatabaseModelInclude.tt include file which contains my set of common functions which hide the complexity of DACFx. So when we save our new template or select Run Custom Tool from the Solution Explorer window, the HistoryTables T4 Template will generate a .sql file containing all the history tables. For example, here is part of the generated file:

image

Download the Sample Code for T-SQL

Rather than provide the code sample as part of this post, I have published the code on CodePlex so that I can document and extend the library of functions properly. So download the sample code from here: T4 Template to auto-generate T-SQL from SSDT database model using DacFx. To use these samples, you will need Visual Studio 2013 which has SQL Server Data Tools built-in, or Visual Studio 2012 with the latest version of SSDT which can be downloaded from here.

T4 Templates in colour

By default, T4 Templates are treated by Visual Studio as normal text files, with no syntax highlighting. If you don’t like this black and white world, you can download one of the many free editors. Two I have tried are:

However, be warned that both editors provide erratic syntax highlighting when the syntax is fundamentally wrong, so if your world goes black and white, check your syntax!

Creating your first T4 Template?

To add a T4 Template to a SSDT solution, select a location within your solution within Solution Explorer in simply click Add Item and select Text Template under Visual Studio Templates.

image

As you can see in the above dialog, you have two Text Template options. The first gives you pretty much a blank screen which is the best option to select when using my include file. The second option provides a sample T4 Template which uses the content of the DACPAC generated by SSDT on your last build (i.e. option 2 of three ways you could implement T4 Templates listed above). In either case, the first thing you need to do is delete everything and add the following to your template:

image

Certainly I would recommend having a play with the standard template, but unless you are a strong C# programmer, you will soon get lost in the DacFx model as it is loosely typed and does not give you any guidance as to whether the object is a Table, View, Index, Tigger or anything else as they’re all represented by the one TSqlObject class. Ultimately this makes it hard to navigate the database model in a natural way. In particular I struggled for hours before I figured out how to obtain the details of the foreign key relationships for a table; and even then some of the information is missing (i.e. the name of the source column in the relationship).

Automatically regenerated your code prior to build?

By default, T4 templates do not get regenerated the code prior to a build. Microsoft have documented that auto-regeneration can be configured on their page outlining Design-Time Code Generation by using T4 Text Templates which requires the installation of the Modeling SDK for Microsoft Visual Studio 2013 to work. However, in my experience the transformation fails with the following error:

------ Build started: Project: AdventureWorksDW2014, Configuration: Debug Any CPU ------
Transforming template T4_Templates\DACPAC_Example.tt...
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TextTemplating\Microsoft.TextTemplating.targets(396,5): Error: : A processor named 'SqlModelDirectiveProcessor' could not be found for the directive named 'SqlModelDirective'. The transformation will not be run. . Line=3, Column=4
Done building project "AdventureWorksDW2014.sqlproj" -- FAILED.
Build FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

Searching the forums, I find evidence to suggest that T4 templates using DacFx will not run from the command-line as there is some unique code run which the directive processor requires to access the database model.  The same problem seems to occur when you select Transform All T4 Templates from the Build menu in Visual Studio. However, this method claims all is well, yet does not actually transform the templates.

Use SQL Server Data Tools – No excuses

Although SQL Server Data Tools (SSDT) was originally released with SQL Server 2012, it also supports SQL Server versions down to SQL Server 2005, so if you are not already using SQL Server Data Tools, then I would strongly encourage you to do so. I key strength of the new tool is that it allows more effective use of source code control and makes it far easier to implement continuous integration as noted by Keith Schreiner in his blog Auto-deploy and version your SQL Server database with SSDT.

Upgrading is straight forward and lots of ‘project’ artefacts can be removed as outlined here. Given it supports all SQL Server versions back to 2005, moving to the latest desktop development tools is much easier than transitioning your servers and ultimately will allow you to upgrade your code base and servers more efficiently when the time comes. Note that SQL Server Data Tools (SSDT) is built into Visual Studio 2013, so no separate install required. However, always ensure you have the latest version of SQL Server Data Tools for Visual Studio 2012.

T4 Templates - Community Resources

Here are a few interesting resources out there which you will find useful when using T4 Templates to generate T-SQL code.

This blog entry forms part of the backdrop for my presentation at SQL Saturday Cambridge on 12th September 2015 where I will be talking about continuous integration and the data warehouse. Of course, T4 templates will be covered amongst numerous other techniques.

http://sqlblogcasts.com/blogs/drjohn/archive/2015/07/08/supercharge-your-ssdt-database-projects-using-t4-to-auto-generate-t-sql-code.aspx


Метки:  

Поиск сообщений в rss_sqlblogcasts
Страницы: 10 9 8 [7] 6 5 ..
.. 1 Календарь