The thing inside of us that makes us go up is our attitude.
Phil Factor – Simple Talk
A technical journal and community hub from Redgate

Phil Factor – Simple Talk
  • Pivot Rotation and Matrix Transpose in SQL Server: A New Method?

    The question often comes up: how do you pivot data in SQL Server? In looking closer at the question, there are two similar effects that are wanted. One is the equivalent to a pivot table in Excel, the other is a matrix transposition, where a table is simply rotated, as if it were an array, …

    The post Pivot Rotation and Matrix Transpose in SQL Server: A New Method? appeared first on Simple Talk.



  • The Power of Three and the Wooden Computer

    The mystery of one of the almost-forgotten pioneers of the computer starts Phil Factor on a quest to explore and simulate in SQL the arithmetic operations of the lost wooden computer of Thomas Fowler. It is a homage to a little-known genius and an illustration of some curious SQL techniques.…

    The post The Power of Three and the Wooden Computer appeared first on Simple Talk.



  • Importing JSON Data from Web Services and Applications into SQL Server

    To support many applications, it makes sense for the database to work with JSON data, because it is the built-in way for a JavaScript or TypeScript application to represent object data. It can mean less network traffic, looser coupling, and less need for the application developer to require full access to the base tables of the database. However, it means that the database must do plenty of checks first before importing. Phil Factor explains how it can be easily done.…

    The post Importing JSON Data from Web Services and Applications into SQL Server appeared first on Simple Talk.



  • Consuming hierarchical JSON documents in SQL Server using OpenJSON

    Over the years, Phil was struck by the problems of reading and writing JSON documents with SQL Server, and wrote several articles on ways of overcoming these problems. Now that SQL Server 2016 onwards has good JSON support, he thought that the articles would be forgotten. Not so, they continue to be popular, so he felt obliged to write about how you can use SQL Server's JSON support to speed the process up.…

    The post Consuming hierarchical JSON documents in SQL Server using OpenJSON appeared first on Simple Talk.



  • SQL Code Smells

    Some time ago, Phil Factor wrote his booklet 'SQL Code Smells', collecting together a whole range of SQL Coding practices that could be considered to indicate the need for a review of the code. It was published as 119 code smells, even though there were 120 of them at the time. Phil Factor has continued to collect them and the current state of the art is reflected in this article. There are now around 150 of these smells and SQL Code Guard is committed to cover as many as possible of them. …

    The post SQL Code Smells appeared first on Simple Talk.



  • When is the Data Deleted?

    Imagine that your business is providing a service to individuals, and you charge by the amount of usage. You are trading your service internationally and need to keep a record of who among your customers does what. You then produce invoices and keep accounts. Your customers pay via a third-party service. So far so good. …

    The post When is the Data Deleted? appeared first on Simple Talk.



  • Statistics in SQL: Student’s t-test

    Many undergraduates have misunderstood the name 'Students' in the t-test to imply that it was designed as a simple test suitable for students. In fact it was William Sealy Gosset, an Englishman publishing under the pseudonym Student, who developed the t-test and t distribution in 1908, as a way of making confident predictions from small sample sizes of normally-distributed variables. As Gosset's employer was Guinness, the brewer, Phil Factor takes a sober view of calculating it in SQL.…

    The post Statistics in SQL: Student’s t-test appeared first on Simple Talk.



  • Pseudonymization and the Inference Attack

    It is surprising that so much can be identified by deduction from data. You may assume that you can safely distribute partially masked data for reporting, development or testing when the original data contains personal information. Without this sort of information, much medical or scientific research would be vastly more difficult. However, the more useful the data is, the easier it is to mount an inference attack on it to identify personal information. Phil Factor explains.…

    The post Pseudonymization and the Inference Attack appeared first on Simple Talk.



  • Statistics in SQL: The Mann–Whitney U test

    Imagine you have some data. Maybe you’ve done a web redesign and you want to do some A/B testing to see if by redesigning the page your visitors spend more time reading your content. You set up an experiment in which visitors are randomly sent to either the old or new design, and you measure …

    The post Statistics in SQL: The Mann–Whitney U test appeared first on Simple Talk.



  • Is It Time To Stop Using IsNumeric()?

    The old system function IsNumeric() often causes exasperation to a developer who is unfamiliar with the quirks of Transact SQL. It seems to think a comma or a number with a 'D' in the midde of it is a number. Phil Factor explains that though IsNumeric has its bugs, it real vice is that it doesn't tell you which of the numeric datatypes the string parameter can be coerced into, and because it doesn't check for overflow. Phil comes to the rescue with a couple of useful alternatives, one of which works whatever version of SQL Server you have, and which tell you what datatype the string can be converted to.…

    The post Is It Time To Stop Using IsNumeric()? appeared first on Simple Talk.