Trying to share some code ideas

logo

Category: SQL Page 1 of 3

Temporal Tables

Where we are going, we need to keep track of the history in the tables.

How to set up and use Temporal Tables in Microsoft SQL Microsoft SQL has native support for keeping track of Insert / Update / Delete from system versioned tables. The following explains how to set up and use temporal tables in Microsoft SQL.

Foreign Key List

Query to show foreign keys for specified table and or column

Search Value in Multiple Columns

Where is it? WHERE IS IT? WHERE????

Sometimes you need to search for a value in the table, but you have no idea where it is. The query will use a cursor allowing you to search through multiple tables and multiple columns to find the value.

Date Format List

Stop searching the web for date formats, query the database

Michael M.

Simple query to show you all the date time formats in the database.

Code for View

Show the DDL Code for a View

Check Login Security

Show the user’s login security

Column Names by Table with Row Counts

How big is it? Big? Really Big? Ginormous???

Yesterday, I posted a quick query Column Names by Table on how to search for a column in any table in the database. Today’s query will extend that functionality to let you know how many rows are in the table while avoiding the dreaded

SELECT   COUNT(*)   FROM dbo.SuperHugeTable;

Column Names by Table

Where is it? Seriously, where is it?

We’ve all had the experience of trying to locate a specific column name or wanting to see the meta-data for columns in a specific or multiple tables. By reading the information schema tables we can see the meta-data and find all occurences of the column in the database. This information can be quite useful when needing to join columns and finding some hidden relationships.

Add a Space Before Upper Case Letter

“Why doesn’t this function exist?”

We have all had the situation where there is a need for a little custom function to modify strings or do simple math on a column. Today I am going to show how to create a User Defined Function (UDF) in Microsoft SQL.

Oracle PL/SQL More Aggregation – Rank

Oracle PL/SQL Aggregation  – Rank

One of the more interesting aggregation functions is RANK.  After doing a standard SELECT and GROUP BY; you can then have SQL rank the results using an aggregated value from another column.

Let’s dive in and look at how RANK works and what can it do for us.

Page 1 of 3

Powered by WordPress & Theme by Anders Norén