Jeff Jones – Interface Technical Training https://www.interfacett.com Wed, 21 Jun 2017 19:26:18 +0000 en-US hourly 1 Video: Itzik Ben-Gan on the new features of Microsoft SQL Server 2012 Denali https://www.interfacett.com/blogs/itzik-ben-gan-on-the-new-features-of-microsoft-sql-server-2012-denali/ https://www.interfacett.com/blogs/itzik-ben-gan-on-the-new-features-of-microsoft-sql-server-2012-denali/#respond Wed, 23 Nov 2011 20:31:51 +0000 http://www.interfacett.com/blogs/?p=?p=2817 Interface Technical Training hosted a very special Advanced T-SQL course with SQL MVP Itzik Ben-Gan on October 17-21, 2011. We sat down with Mr. Ben-Gan to get his thoughts on various topics related to Transact SQL. In this video, Itzik shares his insights on the new features of SQL Server 2012 codename “Denali”. Below is … Continue reading Video: Itzik Ben-Gan on the new features of Microsoft SQL Server 2012 Denali

The post Video: Itzik Ben-Gan on the new features of Microsoft SQL Server 2012 Denali appeared first on Interface Technical Training.

]]>

Interface Technical Training hosted a very special Advanced T-SQL course with SQL MVP Itzik Ben-Gan on October 17-21, 2011.

We sat down with Mr. Ben-Gan to get his thoughts on various topics related to Transact SQL. In this video, Itzik shares his insights on the new features of SQL Server 2012 codename “Denali”.

Below is the transcription of the video.

Jeff Jones: You mentioned that SQL Server 2012 was just announced and your class will cover a lot of the new functionality. There seems to be a lot of new T-SQL in this particular release, which is great, and you’re going to spend some time on that to get people a good understanding.

Itzik Ben-Gan: Correct, the course isn’t really version-specific so it’s not like the course is SQL Server 2012 focused. It covers versions 2005, 2008 and 2012. Some of the language features in 2012 are quite profound and some very common problems are now solvable with the unbelievable performance in the newest version.

Classic examples are things like ‘running totals’.

Set-based solutions up to SQL Server 2008 R2 were treated very badly by the optimizers, so simply running totals with classic set-based solutions that use either subqueries or joins was called in computer science ‘algorithmic complexity’ or ‘quadratic scaling’ and ‘square scaling’, where the number of rows that you’re dealing with increase by a factor of say ‘f’ then the work involved increases by a factor of ‘f-squared’.

So if you think about this, once you get into tables that aren’t necessarily very large – for example, take a table that is 100,000 rows, now square that number and try to imagine how large it will become. That’s a lot of rows to get processed. The ironic thing is the classic set-based solutions perform so badly that people have to resort to cursors or other means that are not really supported.

So with SQL Server 2012, I think some of the most important features in the language are features known as ‘Window Functions’. While it was already implemented in a partial manner in SQL Server 2005, the critical parts needed to solve these kind of problems efficiently – such capabilities in aggregate Window Functions that include what’s called ‘ordering and framing options’ – now allow us to solve running totals and many similar types of problems very eloquently, very simply and with linear scaling. They can simply do one pass over the data.

I tested it with a query that had 2 million rows. Using a classic set-based solution, it would take a matter of years before the subquery would be finished. But now, it’s a matter of something like 7 seconds for the very same query to complete one pass over the data.

And that’s just part of the enhancements in SQL Server 2012. There are number of enhancements that relate to these profound Windows Functions, including additional functions, such as offset functions called leg, lead, first-value, last-value and statistical functions. The most important are the improvement in the aggregate Window Functions.

Then there are other new functionalities. There’s a new filtering option called Offset-Fetch that allows improved paging capabilities similar to ‘Top’ but it also has skipping capabilities. Where ‘Top’ allows you to restrict such and such rows, Offset-Fetch allows you to skip rows and now fetch certain rows. So it can do simple paging concepts.

Sequence object allows us to autogenerate keys but with an object that is not tied to a particular column inside a table like the identity attribute. So we get into Sequence object advantages over the existing identity solutions, as well as other enhancements. These are some of the key enhancements in SQL Server 2012.

Jeff Jones: So if you’re trying to figure out why you would want to do an upgrade to SQL Server 2012, you are going to be able to show people the tremendous benefits of that upgrade?

Itzik Ben-Gan: Certainly, there are some features that ‘no doubt’ that will provide a big justification to upgrade.

Upcoming live Microsoft SQL Server classes at Interface Technical Training:
SQL100: Introduction to Transact-SQL
SQL250: Transact-SQL for Developers
SQL400: Itzik Ben-Gan’s Advanced T-SQL Querying, Programming and Tuning for SQL Server 2005, 2008 and 2012
6231R2: Maintaining a Microsoft SQL Server 2008 R2 Database
6232R2: Implementing and Maintaining Microsoft SQL Server 2008 R2 Database
BI6234: Implementing and Maintaining Microsoft SQL Server 2008 Analysis Services
BI6235: Implementing and Maintaining Microsoft SQL Server 2008 Integration Services
BI6236: Implementing and Maintaining Microsoft SQL Server 2008 Reporting Services

 

Is there a DrillBit™ Video you would like to see?
Let us know in the comments section below. If it’s a popular technical problem, we’ll make a DrillBit™ video with the solution.

The post Video: Itzik Ben-Gan on the new features of Microsoft SQL Server 2012 Denali appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/itzik-ben-gan-on-the-new-features-of-microsoft-sql-server-2012-denali/feed/ 0
Video – Itzik Ben-Gan on T-SQL Query Optimization at Interface Technical Training https://www.interfacett.com/blogs/video-itzik-ben-gan-on-t-sql-query-optimization-at-interface-technical-training/ https://www.interfacett.com/blogs/video-itzik-ben-gan-on-t-sql-query-optimization-at-interface-technical-training/#respond Tue, 08 Nov 2011 20:36:19 +0000 http://www.interfacett.com/blogs/?p=?p=2602 Interface Technical Training hosted a very special Advanced T-SQL course with SQL MVP Itzik Ben-Gan on October 17-21, 2011. We sat down with Mr. Ben-Gan to get his insights on various topics related to Transact SQL. In this video, Itzik discusses how to optimize queries in your SQL Server Database. Below is the transcription of … Continue reading Video – Itzik Ben-Gan on T-SQL Query Optimization at Interface Technical Training

The post Video – Itzik Ben-Gan on T-SQL Query Optimization at Interface Technical Training appeared first on Interface Technical Training.

]]>

Interface Technical Training hosted a very special Advanced T-SQL course with SQL MVP Itzik Ben-Gan on October 17-21, 2011.

We sat down with Mr. Ben-Gan to get his insights on various topics related to Transact SQL. In this video, Itzik discusses how to optimize queries in your SQL Server Database.

Below is the transcription of the video.

“You need to understand how the SQL Server engine works. The language is logical and the standard language doesn’t care about the performance side of the query. Therefore, when the standard SQL describes a query construct, there is no standard way to optimize the query execution within any database platform. It’s the platforms responsibility to create a physical execution plan to process the query. Different database platforms can use different ways to process the query. Therefore, you need to be very familiar with the specifics of the platform you’re working with. There are some common physical structures that look similar in different platforms but there are also some unique structures and behaviors that are platform-dependent in terms of optimization.

People like to use ‘rules-of-thumb’. Statements like “use joins instead because they work better than sub-queries”. But reality can be different. The idea in query tuning; beyond gaining a lot of knowledge and experience with a particular platform is understanding what it does well and doesn’t do well. You must keep an open mind and try to reach solutions from your experience that tend to perform well. While expecting the fact that certain circumstances that you’re not thinking of could make the solution not perform well. Then understanding what you can do to help your code perform better both in terms of physical structure (such as indexing) as-well-as how you write the code.

So it could be that within the same physical environments, you write 5 different solutions and each of them will get a completely different plan. So you need to understand why even though you’re writing two different queries that logically achieve the same result, why is it that the engine can produce different plans and identifying the differences in the plan can lead you to the correct adjustments and get to the query that will perform better.

There is a lot to learn about the different query iterators or the query plan iterators and understanding the different types of access methods such as ordered scans, unordered scans, seek operations, look-ups, those that go against heaps and those that go against B-tree indexes. There are many different access methods as well as other kinds of iterators that you can find in the plan and understand how to analyze them, identify the more expensive ones and then figure out ways to avoid them.”

Upcoming live Microsoft SQL Server classes at Interface Technical Training:
SQL100: Introduction to Transact-SQL
SQL250: Transact-SQL for Developers
SQL400: Itzik Ben-Gan’s Advanced T-SQL Querying, Programming and Tuning for SQL Server 2005, 2008 and 2012
6231R2: Maintaining a Microsoft SQL Server 2008 R2 Database
6232R2: Implementing and Maintaining Microsoft SQL Server 2008 R2 Database
BI6234: Implementing and Maintaining Microsoft SQL Server 2008 Analysis Services
BI6235: Implementing and Maintaining Microsoft SQL Server 2008 Integration Services
BI6236: Implementing and Maintaining Microsoft SQL Server 2008 Reporting Services

 

Is there a DrillBit™ Video you would like to see?
Let us know in the comments section below. If it’s a popular technical problem, we’ll make a DrillBit™ video with the solution.

The post Video – Itzik Ben-Gan on T-SQL Query Optimization at Interface Technical Training appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/video-itzik-ben-gan-on-t-sql-query-optimization-at-interface-technical-training/feed/ 0
Advanced T-SQL Class at Interface with MVP Itzik Ben-Gan, and you can attend online with Remote Live™ https://www.interfacett.com/blogs/advanced-t-sql-class-at-interface-with-mvp-itzik-ben-gan-and-you-can-attend-online-with-remote-live%e2%84%a2/ https://www.interfacett.com/blogs/advanced-t-sql-class-at-interface-with-mvp-itzik-ben-gan-and-you-can-attend-online-with-remote-live%e2%84%a2/#respond Wed, 31 Aug 2011 22:16:11 +0000 http://www.interfacett.com/blogs/?p=?p=1522 I’ve had a lot of requests for an Advanced T-SQL class over the years. I’m proud to announce that Interface is now offering a 5-day Advanced T-SQL Querying, Programming & Tuning class from world-renowned instructor and MVP Itzik Ben-Gan on October 17, 2011. You can also attend this class online with Remote Live™ if you … Continue reading Advanced T-SQL Class at Interface with MVP Itzik Ben-Gan, and you can attend online with Remote Live™

The post Advanced T-SQL Class at Interface with MVP Itzik Ben-Gan, and you can attend online with Remote Live™ appeared first on Interface Technical Training.

]]>

I’ve had a lot of requests for an Advanced T-SQL class over the years.
I’m proud to announce that Interface is now offering a 5-day Advanced T-SQL
Querying, Programming & Tuning class from world-renowned instructor and MVP
Itzik Ben-Gan on October 17, 2011.

You can also attend this class online with Remote Live™ if you or your colleagues can't make it in person.

This Advanced T-SQL class is going to take your SQL skills to the next level.  Not only will Itzik teach you the advanced capabilities of T-SQL, he will provide you the skills necessary to effectively use these features.

Itzik has written some of the best books on T-SQL available.  He has also traveled around the world teaching people how to get the most out of the language.  This is the first time this class has been publicly available in the Phoenix area.

When you are developing T-SQL queries, you have to address numerous challenges.

  • First you need to make sure you are solving the business problem.
  • You need a solid understanding of the various features of T-SQL and how to properly use these features to meet the requirements of the application.
  • You need to be able to assess how the T-SQL query is performing and be able to either restructure the query or add new structures to the database to improve performance when necessary.

Itzik’s class addresses these challenges in great depth with his unique insights into the mechanics of T-SQL.

Here is a link with more information: Advanced T-SQL Querying, Programing & Tuning SQL Server

I hope you take advantage of this very special class.

The post Advanced T-SQL Class at Interface with MVP Itzik Ben-Gan, and you can attend online with Remote Live™ appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/advanced-t-sql-class-at-interface-with-mvp-itzik-ben-gan-and-you-can-attend-online-with-remote-live%e2%84%a2/feed/ 0
Downloading all Adventureworks databases by Jeff Jones – Interface Technical Training https://www.interfacett.com/blogs/downloading-all-adventureworks-databases-by-jeff-jones-interface-technical-training/ https://www.interfacett.com/blogs/downloading-all-adventureworks-databases-by-jeff-jones-interface-technical-training/#respond Mon, 11 Oct 2010 22:47:09 +0000 http://www.interfacett.com/blogs/?p=424 You can get to all Adventureworks databases by going to the following link on Codeplex.com. This includes, Adventureworks, AdventureworksDW, Adventureworks2008, AdventureworksDW2008 and AdventureworksLT2008. Make sure you download the correct release of the samples based on the release of SQL Server you are using. Adventureworks Sample Databases – http://msftdbprodsamples.codeplex.com/

The post Downloading all Adventureworks databases by Jeff Jones – Interface Technical Training appeared first on Interface Technical Training.

]]>
You can get to all Adventureworks databases by going to the following link on Codeplex.com.

This includes, Adventureworks, AdventureworksDW, Adventureworks2008, AdventureworksDW2008 and AdventureworksLT2008.

Make sure you download the correct release of the samples based on the release of SQL Server you are using.

Adventureworks Sample Databases – http://msftdbprodsamples.codeplex.com/

The post Downloading all Adventureworks databases by Jeff Jones – Interface Technical Training appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/downloading-all-adventureworks-databases-by-jeff-jones-interface-technical-training/feed/ 0
Links to SQL Server User Group Community in Phoenix, AZ – by Jeff Jones https://www.interfacett.com/blogs/links-to-sql-server-user-group-community-in-phoenix-az-by-jeff-jones/ https://www.interfacett.com/blogs/links-to-sql-server-user-group-community-in-phoenix-az-by-jeff-jones/#respond Thu, 15 Jul 2010 22:56:31 +0000 http://www.interfacett.com/blogs/?p=?p=429 Here are a couple of links to the Arizona SQL Server User Group community.  The first is the Arizona SQL Server User Group.  It usually meets each month except during the summer. The second is a link to SQL Saturday.  A group of SQL Server users are attempting to organize a SQL Saturday event.  Check … Continue reading Links to SQL Server User Group Community in Phoenix, AZ – by Jeff Jones

The post Links to SQL Server User Group Community in Phoenix, AZ – by Jeff Jones appeared first on Interface Technical Training.

]]>
Here are a couple of links to the Arizona SQL Server User Group community.  The first is the Arizona SQL Server User Group.  It usually meets each month except during the summer.

The second is a link to SQL Saturday.  A group of SQL Server users are attempting to organize a SQL Saturday event.  Check out this link to get the latest status.

Arizona SQL Server User Group:  http://arizona.sqlpass.org/

SQL Saturday Phoenix – http://www.sqlsaturday.com/47/eventhome.aspx

 

 

The post Links to SQL Server User Group Community in Phoenix, AZ – by Jeff Jones appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/links-to-sql-server-user-group-community-in-phoenix-az-by-jeff-jones/feed/ 0
SQL Server 2008 Policy Management Links by Jeff Jones – Interface Technical Training https://www.interfacett.com/blogs/sql-server-2008-policy-management-links-by-jeff-jones-interface-technical-training/ https://www.interfacett.com/blogs/sql-server-2008-policy-management-links-by-jeff-jones-interface-technical-training/#respond Tue, 25 May 2010 23:05:06 +0000 http://www.interfacett.com/blogs/?p=?p=433 Here are few links to blogs and open source projects related to Policy Management with SQL Server 2008. The SQL Server Policy Management Team blog – http://blogs.msdn.com/sqlpbm Bart Duncan's blog entry on Complex Server "Health" Policies – http://shrinkster.com/1bqq Codeplex project to provide a dashboard for Policy Management – http://epmframework.codeplex.com  

The post SQL Server 2008 Policy Management Links by Jeff Jones – Interface Technical Training appeared first on Interface Technical Training.

]]>
Here are few links to blogs and open source projects related to Policy Management with SQL Server 2008.

The SQL Server Policy Management Team blog – http://blogs.msdn.com/sqlpbm

Bart Duncan's blog entry on Complex Server "Health" Policies – http://shrinkster.com/1bqq

Codeplex project to provide a dashboard for Policy Management – http://epmframework.codeplex.com

 

The post SQL Server 2008 Policy Management Links by Jeff Jones – Interface Technical Training appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/sql-server-2008-policy-management-links-by-jeff-jones-interface-technical-training/feed/ 0
Extracting SSIS Package information using T-SQL https://www.interfacett.com/blogs/jeff-jones-blog-2010-5-19-extracting-ssis-package-information-using-t-sql/ https://www.interfacett.com/blogs/jeff-jones-blog-2010-5-19-extracting-ssis-package-information-using-t-sql/#comments Mon, 10 May 2010 20:08:56 +0000 http://184.168.56.253/?p=195 SQL Server Integration Services can store it packages in either the file system or the MSDB system database.  One of the advantages of storing a package in MSDB is that you can use T-SQL to read the package definition and generate reports on your SSIS package library. Here are a couple of example queries to … Continue reading Extracting SSIS Package information using T-SQL

The post Extracting SSIS Package information using T-SQL appeared first on Interface Technical Training.

]]>
SQL Server Integration Services can store it packages in either the file system or the MSDB system database.  One of the advantages of storing a package in MSDB is that you can use T-SQL to read the package definition and generate reports on your SSIS package library.

Here are a couple of example queries to extract the package GUID for each package and to display the connection string for each OLEDB connection manager in a package.

Example 1: Package GUID display

 


USE MSDB
GO
WITH xmlPackages
-- Read sysssispackage and convert packagedata image column to XML datatype
AS
(SELECT [name]
, [Description]
, verbuild
, CAST(CAST(packagedata as VARBINARY(MAX)) AS XML) PackageXML
FROM dbo.sysssispackages)
,
Packages
-- Cross join each package row with itself to extract out the GUID then convert it to VARCHAR

AS
(SELECT [name]
, [Description]
, [verbuild]
, x.guid.value('text()[1]', 'varchar(4000)') PackageGUID
FROM xmlPackages
CROSS APPLY
PackageXML.nodes('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; //DTS:Executable/DTS:Property[@DTS:Name="VersionGUID"]') AS x(guid)
)

SELECT *
FROM Packages

 

Example 2: Display Connections strings for each OLEDB Connection Manager
 

USE MSDB
GO
WITH xmlPackages
-- Read sysssispackages and convert packagedata image column to XML datatype
AS
(SELECT [name]
, [Description]
, verbuild
, CAST(CAST(packagedata as VARBINARY(MAX)) AS XML) PackageXML
FROM dbo.sysssispackages)
,
Packages
-- Cross join each package row with OLEDB connections found in the package and convert it to VARCHAR
AS
(SELECT [name]
, [Description]
, [verbuild]
, x.cn.value('text()[1]', 'varchar(4000)') Conn
FROM xmlPackages
CROSS APPLY
PackageXML.nodes('declare namespace DTS="www.microsoft.com/SqlServer/Dts"; //DTS:ConnectionManager[DTS:Property="OLEDB"]/DTS:ObjectData/DTS:ConnectionManager/DTS:Property [@DTS:Name="ConnectionString"]') AS x(cn)
)
SELECT [Name] PackageName
, [Description]
, [verbuild]
, Conn ConnectionString
FROM Packages


 

The post Extracting SSIS Package information using T-SQL appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/jeff-jones-blog-2010-5-19-extracting-ssis-package-information-using-t-sql/feed/ 5
SQL Server SSRS Reporting Services download Links https://www.interfacett.com/blogs/jeff-jones-blog-2010-2-19reporting-services-interesting-links/ https://www.interfacett.com/blogs/jeff-jones-blog-2010-2-19reporting-services-interesting-links/#respond Fri, 19 Feb 2010 16:49:35 +0000 http://www.interfacett.com/blogs/?p=382 Below are links to projects in Codeplex.com where you can download the Adventureworks Sample databases and sample codes for reporting services.  I have included a link to download a report to link SQL Agent job names created by Reporting Services to Report Names and some other useful queries against the Report Server databases. Also a … Continue reading SQL Server SSRS Reporting Services download Links

The post SQL Server SSRS Reporting Services download Links appeared first on Interface Technical Training.

]]>
Below are links to projects in Codeplex.com where you can download the Adventureworks Sample databases and sample codes for reporting services.  I have included a link to download a report to link SQL Agent job names created by Reporting Services to Report Names and some other useful queries against the Report Server databases.

Also a link to the Demo files I use in our BI6236 class.  And finally a link to a website that has a T-SQL function for splitting a comma-delimited list into a multi-row table.

Adventureworks Sample Databases – http://msftdbprodsamples.codeplex.com/

Reporting Services Sample Code – http://msftrsprodsamples.codeplex.com/

RS Server Mgmt Report Samples – http://msftrsprodsamples.codeplex.com/wikipage?title=SS2008%21Server%20Management%20Sample%20Reports&referringTitle=Home

Report Server Job Report, All Subscriptions Query, Cache Expiration Query – http://75.126.165.131/files/sql/reportserverjobreport.zip

BI6236 Course Demo files – http://75.126.165.131/files/sql/bi6236demos.zip
RSScripter and RSLinkGen tool – http://sqldbatips.com

Code for a Split function you can use to convert multi-valued parameters into a table so you can use them in a stored procedure or function – http://tinyurl/fnsplit

 

 

The post SQL Server SSRS Reporting Services download Links appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/jeff-jones-blog-2010-2-19reporting-services-interesting-links/feed/ 0
FN_Split() Table Valued Function by SQL Instructor Jeff Jones https://www.interfacett.com/blogs/fn_split-table-valued-function-by-sql-instructor-jeff-jones/ https://www.interfacett.com/blogs/fn_split-table-valued-function-by-sql-instructor-jeff-jones/#respond Sat, 08 Dec 2007 17:52:41 +0000 http://184.168.56.253/?p=326 Fn_Split() The link above is to a file with a table-valued function called fn_split(). This function allows you to pass a string of values to an IN clause of a SQL query. It breaks them down into a set of rows in a virtual table. Then you use a subquery in the IN clause. This function … Continue reading FN_Split() Table Valued Function by SQL Instructor Jeff Jones

The post FN_Split() Table Valued Function by SQL Instructor Jeff Jones appeared first on Interface Technical Training.

]]>
Fn_Split()

The link above is to a file with a table-valued function called fn_split(). This function allows you to pass a string of values to an IN clause of a SQL query. It breaks them down into a set of rows in a virtual table. Then you use a subquery in the IN clause.

This function is very useful when passing multi-valued parameters in a SQL Server Reporting Services report into a stored procedure.  The parameter is defined in the stored procedure as a large varchar string (max 8000 character).  In the stored procedure you would reference the function in the WHERE clause where you  want to use the multiple parameter values.

Example:

SELECT *
FROM table
WHERE column IN (SELECT [value] FROM dbo.fn_split(@parameter, ','))

The post FN_Split() Table Valued Function by SQL Instructor Jeff Jones appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/fn_split-table-valued-function-by-sql-instructor-jeff-jones/feed/ 0
Who has access? – SQL Server https://www.interfacett.com/blogs/who-has-access-sql-server/ https://www.interfacett.com/blogs/who-has-access-sql-server/#respond Wed, 11 Jul 2007 22:42:18 +0000 http://www.interfacett.com/blogs/?p=?p=593 Occasionally you would like to find out all the tables, views and stored procedures a user can access and what permissions they have.  With a combination of the new EXECUTE AS command and the new HAS_PERMS_BY_NAME function you can figure this out.  Below is a query that uses the sys.All_Objects metadata view to generate object names.  Then it passes … Continue reading Who has access? – SQL Server

The post Who has access? – SQL Server appeared first on Interface Technical Training.

]]>
Occasionally you would like to find out all the tables, views and stored procedures a user can access and what permissions they have.  With a combination of the new EXECUTE AS command and the new HAS_PERMS_BY_NAME function you can figure this out.  Below is a query that uses the sys.All_Objects metadata view to generate object names.  Then it passes the object names through the new function with some additional parameters (the securable type, and permission type) and it returns 1 if the user has that permission and 0 if they do not.

The result shows both implicit permissions granted through fixed server or database roles. It also shows explicit permission granted though user-defined roles or granted directly to the database user account.

The EXECUTE AS can only specify individual user principal defined to SQL Server.  It cannot reference a Windows Group.  This is only valid with SQL Server 2005.

EXECUTE AS LOGIN = 'miami\anders'

SELECT SCHEMA_NAME(schema_id) + '.' + name TableName
, type_desc
, HAS_PERMS_BY_NAME(SCHEMA_NAME(schema_id) + '.' + name,
'OBJECT', 'SELECT') AS have_select
, HAS_PERMS_BY_NAME(SCHEMA_NAME(schema_id) + '.' + name,
'OBJECT', 'UPDATE') AS have_update
, HAS_PERMS_BY_NAME(SCHEMA_NAME(schema_id) + '.' + name,
'OBJECT', 'INSERT') AS have_insert
, HAS_PERMS_BY_NAME(SCHEMA_NAME(schema_id) + '.' + name,
'OBJECT', 'DELETE') AS have_delete
, HAS_PERMS_BY_NAME(SCHEMA_NAME(schema_id) + '.' + name,
'OBJECT', 'EXECUTE') AS have_execute
FROM sys.all_objects
WHERE type_desc IN ('USER_TABLE', 'SQL_STORED_PROCEDURE', 'VIEW')
AND SCHEMA_NAME(schema_id) NOT IN ('sys', 'INFORMATION_SCHEMA')
ORDER BY type_desc, tablename

REVERT

The post Who has access? – SQL Server appeared first on Interface Technical Training.

]]>
https://www.interfacett.com/blogs/who-has-access-sql-server/feed/ 0