Find Column In SQL Using INFORMATION_SCHEMA

● Ian Grieve ●  ● 0 Comments   ● 

Microsoft Dynamics GPLast year I posted a script to find tables containing a particular column using sys objects. Steve Endow of Dynamics GP Land suggested using the INFORMATION_SCHEMA instead as he found it easier to use.

I’ve recently had reason to search for tables with a particular column in them, so I took a look at using a script using INFORMATION_SCHEMA.COLUMNS. However, when taking a detailed look at the results I found a few anomalies; the issue was that INFORMATION_SCHEMA.COLUMNS returns results for columns in not only tables, but also views. Which does make sense as both tables and views have columns. For what I was working on I needed a list of only tables.

I did a little exploring of the INFORMATION_SCHEMA and determined that I could join to INFORMATION_SCHEMA.TABLES and filter on TABLE_TYPE <> ‘VIEW’ to get a result set of only tables:

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (http://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
DECLARE @ColumnToFind VARCHAR(20) = 'PAYRCORD'
SELECT
	['Tables'].TABLE_SCHEMA AS 'Schema'
	,['Tables'].TABLE_NAME AS 'Table'
FROM
	INFORMATION_SCHEMA.COLUMNS AS ['Columms']
INNER JOIN
	INFORMATION_SCHEMA.TABLES AS ['Tables']
		ON
			['Tables'].TABLE_CATALOG = ['Columms'].TABLE_CATALOG
		AND
			['Tables'].TABLE_SCHEMA = ['Columms'].TABLE_SCHEMA
		AND
			['Tables'].TABLE_NAME = ['Columms'].TABLE_NAME
		AND
			['Tables'].TABLE_TYPE <> 'VIEW'
WHERE
	COLUMN_NAME = @ColumnToFind
ORDER BY
	'Schema'
	,'Table'

In the original posts script I was using the sys objects directly, but was filtering out the views by joining to sys.tables which contains only tables. Both the original script and the above one return exactly the same result set.

So, what’s the difference?

INFORMATION_SCHEMA, or System Information Schema Views to give the full name, is one of several methods SQL Server provides to get an internal, system table-independent view of the SQL Server metadata. Information schema views enable applications to work correctly although significant changes may have been made to the underlying system tables. The information schema views included in SQL Server originally complied with the ISO standard definition for the INFORMATION_SCHEMA, but appear to have diverged from the standard as new standards have been introduced.

The metadata returned by INFORMATION_SCHEMA, comes from the sys objects. So by using the former you are getting information from the latter, but in a way which should be future proofed against database changes.

● Categories: Microsoft, SQL Server ● Tags: , , ,  ● Permalink ● Shortlink ●

Workflow Error Sending Email: “Execution Of User Code In The dotNET Framework Is Disabled”

● Ian Grieve ●  ● 1 Comment   ● 

Microsoft Dynamics GPThis has come up twice fairly recently. In the first case it was following an upgrade to Microsoft Dynamics GP 2016 and workflow was being introduced for the first time, and in the second it was when a client had created a new test system:

Execution Of User Code In The dotNET Framework Is Disabled

Microsoft Dynamics GP

[Microsoft][SQL Server Native Client 11.0][SQL Server]Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option.

Continue reading → Workflow Error Sending Email: “Execution Of User Code In The dotNET Framework Is Disabled”

● Categories: Dynamics, GP, Microsoft, SQL Server, Workflow ● Tags: , , , , , ,  ● Permalink ● Shortlink ●

Manually Activating Windows 10 Enterprise

● Ian Grieve ●  ● 1 Comment   ● 

Windows 10One of the perks of being a Microsoft Most Valuable Professional (MVP) is the fRee MSDN VisualStudio account. This gives access to pretty much all of Microsoft’s software for development and testing purposes.

The main pieces of software I use is Windows and SQL Server. Usually when writing blog posts about Microsoft Dynamics GP, I use Windows 2012 or 2012 R2, but occasionally I create a Windows client machine with Windows 10.

Usually these machines don’t last long enough to need registering, but I have lately been working on one or two projects which required a somewhat longer life than the free registration period. For Windows Server, this isn’t a problem as the server version of Windows registers online without problems. However, registering Windows 10 Enterprise is not so simple, as the Enterprise editions of Windows requires a Key Management Server to successfully register.

I have never configured one of these as my installations for development and testing are usually fleeting. Instead, there are a couple of commands which can be run which will allow Windows 10 Enterprise to be registered online.

The first command is where you install the KMS key:

slmgr.vbs /ipk {Windows 10 Enterprise Key}

slmgr.vbs /ipk {Windows 10 Enterprise Key}

Continue reading → Manually Activating Windows 10 Enterprise

● Categories: Microsoft, Windows, Windows 10 ● Tags: , , ,  ● Permalink ● Shortlink ●

How To Find Out What SQL Features Are Installed

● Ian Grieve ●  ● 1 Comment   ● 

Microsoft SQL ServerNo day when you learn something new is a wasted day. I was onsite with a client recently to do some work with them on Microsoft Dynamics GP and got chatting to Den in their IT department.

It turns out that SQL Server has a report you can run which will show which features are installed.

The report is run from the SQL Server Installation Center which is available from the Windows Start menu. Click on Tools and then on Installed SQL Server features discovery report:

SQL Server Installation Center

Continue reading → How To Find Out What SQL Features Are Installed

● Categories: Microsoft, SQL Server ● Tags: , , ,  ● Permalink ● Shortlink ●

How To Install Microsoft SQL Server 2016: Installing SQL Server Management Studio

● Ian Grieve ●  ● 0 Comments   ● 

Microsoft Dynamics GPThis is a short series of posts on how to install Microsoft SQL Server 2016; the series index can be found here.

In previous versions of Microsoft SQL Server, SQL Server Management Studio (SSMS) was always part of the standard install, but it seems this has changed with SQL Server 2016.

Instead SSMS is now available as a separate download. I’d recommend downloading the GA rather than any release candidate which might be available:

Download SQL Server Management Studio (SSMS)

Continue reading → How To Install Microsoft SQL Server 2016: Installing SQL Server Management Studio

● Categories: Microsoft, SQL Server, SQL Server 2016, SSMS ● Tags: , , , , , , , , ,  ● Permalink ● Shortlink ●

How To Install Microsoft SQL Server 2016: SSIS Configuration For Named Instances

● Ian Grieve ●  ● 0 Comments   ● 

Microsoft Dynamics GPThis is a short series of posts on how to install Microsoft SQL Server 2016; the series index can be found here.

In the last post, I installed SSIS, but if you are using a named Instance of SQL Server, there is a configuration step required.

To make the change, there is a file called MsDtsSrvr.ini which, for SQL Server 2016, is located in C:\Program Files\Microsoft SQL Server\130\DTS\Binn. The ServerName needs to be changed to include the full SQL Server Instance Name (as highlighted below):

MsDtsSrvr.ini file in Notepad

Once the full SQL Server Instance Name was added and the file saved, SSIS is ready to use.

Click to show/hide the How To Install Microsoft SQL Server 2016 Series Index

● Categories: Microsoft, SQL Server, SQL Server 2016, SSIS 2016 ● Tags: , , , , , , , , ,  ● Permalink ● Shortlink ●

How To Install Microsoft SQL Server 2016: Installing SQL Server Integration Services

● Ian Grieve ●  ● 0 Comments   ● 

Microsoft Dynamics GPThis is a short series of posts on how to install Microsoft SQL Server 2016; the series index can be found here.

When I started the installation of the Analysis Cubes for Microsoft Dynamics GP as part of my ‘Hands On with GP 2016 R2 series, I knew I needed SQL Server Analysis Services (clue was in the name), but I didn’t initially realise that I was going to need SQL Server Integration Services (SSIS) although in retrospect it should have been obvious too.

The reason SSIS is needed, is that the Analysis Cubes in SSAS are populated by integration jobs from SSIS (scheduled using SQL Server Agent).

So I had to come back and install SSIS. You do this by launching the SQL Server setup utility and, under Installation click on New SQL Server stand-alone installation or add features to an existing installation:

SQL Server Installation Center

Continue reading → How To Install Microsoft SQL Server 2016: Installing SQL Server Integration Services

● Categories: Microsoft, SQL Server, SQL Server 2016, SSIS 2016 ● Tags: , , , , , , , , , , ,  ● Permalink ● Shortlink ●

How To Install Microsoft SQL Server 2016: Installing SQL Server Analysis Services

● Ian Grieve ●  ● 0 Comments   ● 

Microsoft Dynamics GPThis is a short series of posts on how to install Microsoft SQL Server 2016; the series index can be found here.

I typically don’t install SQL Server Analysis Services (SSAS), but decided to this time as I was installing all of the Microsoft Dynamics GP additional products for my Hands On with Microsoft Dynamics GP 2016 R2 series.

To install SSAS, launch the SQL Server setup utility and click on Installation and then on New SQL Server stand-alone installation or add features to an existing installation:

SQL Server Installation Center

Continue reading → How To Install Microsoft SQL Server 2016: Installing SQL Server Analysis Services

● Categories: Dynamics, GP, Microsoft, SQL Server, SQL Server 2016, SSAS 2016 ● Tags: , , , , , , , , , , ,  ● Permalink ● Shortlink ●

How To Install Microsoft SQL Server 2016: Configuring SQL Server Reporting Services

● Ian Grieve ●  ● 0 Comments   ● 

Microsoft Dynamics GPThis is a short series of posts on how to install Microsoft SQL Server 2016; the series index can be found here.

In the last post, I installed the SQL Server Database Engine and the Reporting Services, but I did not configure Reporting Services. I mentioned that I have had problems before when doing this, so always do it separately.

To configure SQL Server Reporting Services (SSRS), launch Reporting Services Configuration Manager from the Windows Start menu.

Select the Report Server Instance to connect to and click Connect:

Reporting Services Configuration Connection

Continue reading → How To Install Microsoft SQL Server 2016: Configuring SQL Server Reporting Services

● Categories: Dynamics, GP, Microsoft, SQL Server, SQL Server 2016, SSRS 2016 ● Tags: , , , , , , , , , , ,  ● Permalink ● Shortlink ●

How To Install Microsoft SQL Server 2016: Installing SQL Server Database Engine

● Ian Grieve ●  ● 0 Comments   ● 

Microsoft Dynamics GPThis is a short series of posts on how to install Microsoft SQL Server 2016; the series index can be found here.

In this post, I am going to step through the installation of the Microsoft SQL Server 2016 Database Engine. As most of my work is with Microsoft Dynamics GP, there will be a little focus on the installation required specifically for Dynamics GP, but the basic install is the same regardless of whether it is for Dynamics GP or not.

Launch the SQL Server setup utility (setup.exe), select Installation and click on New SQL Server stand-alone installation or add features to an existing installation:

SQL Server Installation Center

Continue reading → How To Install Microsoft SQL Server 2016: Installing SQL Server Database Engine

● Categories: Dynamics, GP, Microsoft, SQL Server, SQL Server 2016, SSRS 2016 ● Tags: , , , , , , , , ,  ● Permalink ● Shortlink ●