Trying to share some code ideas

logo

Tag: T-SQL Page 1 of 2

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.

Datatype Cast in T-SQL

“Making a square peg fit into a round hole”

There are many times when dealing with data that you need to transfigure one data set to allow for comparison purposes.

SQL has built in functions that easily allow us to transfigure data. There are some considerations when using the functions, most importantly understanding what will happen to the data set during the process.

Today I will talk about the CAST function.

Page 1 of 2

Powered by WordPress & Theme by Anders Norén