Quantcast
Channel: Tips & Tricks – Tomas Lind
Browsing all 13 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Line numbers in t-sql error messages

When you run scripts in SSMS and get an error, the error references a line number in the t-sql statement that caused the error. If you double click the error, SSMS will take you to the error. This...

View Article



Image may be NSFW.
Clik here to view.

Large Inserts and count(*)

If you insert lots of rows into a table with a clustered index, a SELECT COUNT(*) statement on the destination table can initially show 0 (or remain unchanged) for a long time. This is because the...

View Article

Image may be NSFW.
Clik here to view.

Multi Server Query

In SQL Server Management Studio, it is possible to execute a multi server query against several servers at the same time. The description from TechNet says most of it: This topic describes how to...

View Article

Image may be NSFW.
Clik here to view.

Max or min value from a set of columns

The min and max aggregates in SQL Server are normally used to work over rows, getting the max or min value from a set of rows. But what if you want to get the max or min value from a set of columns...

View Article

Mass editing of SQL Server objects

Ever had the need to replace a piece of code in multiple SQL Server objects (Stored Procedure, Trigger, Function or Views)? Here’s a method to search for a string in all objects, replace it with some...

View Article


Image may be NSFW.
Clik here to view.

Sending HTML tables in mail from SQL Server

This post contains a template for sending HTML tables via mail in T-SQL. A prerequisite is that you have created a Database Mail Profile. If you don’t have an email server available, you can use Gmail...

View Article

Image may be NSFW.
Clik here to view.

Calculating Earned Premium in SQL Server

In most business, when a company receives payment for a sold product, that payment can be considered an income. But to an insurance company, only the part of the premium that has been earned (Earned...

View Article

Image may be NSFW.
Clik here to view.

How to fill in gaps in time series

In some cases it is necessary to have an unbroken time series, for instance to have all days during a year. But what if some days are missing from the data? How can we fill in gaps in time series? By...

View Article


Image may be NSFW.
Clik here to view.

sys.dm_exec_cached_plans

The dynamic management view sys.dm_exec_cached_plans returns information on query plans currently in memory. This information can be useful for a lot of reasons: checking total memory allowed for...

View Article


Image may be NSFW.
Clik here to view.

Send email when log or data file grows

One way to keep track of your data- and log file sizes in SQL Server, is to send an email notification whenever a file growth occurs. If you can learn at which times file growth occurs, you may be...

View Article

Image may be NSFW.
Clik here to view.

Split strings to columns

A short demo on how to split strings with delimiters into columns. In this demonstration I have delimited strings of invoices that I want to split into separate columns. The column separator character...

View Article

Toggl Time entries to SQL Server

Toggl is a very simple to use cloud based time tracking application. Time entries on projects and clients can be submitted through the web page or through mobile and desktop applications. Time spent...

View Article

Image may be NSFW.
Clik here to view.

Identity columns that are about to overflow

Identity columns are widely used as primary key columns in SQL Server tables. They can be one of the data types TINYINT, SMALLINT, INT, BIGINT, NUMERIC or DECIMAL. Each of these data types has an...

View Article

Browsing all 13 articles
Browse latest View live




Latest Images