Skip to content

tSQLt apply NOT NULL constraint

How do I apply the NOT NULL constraint back onto a column of a table in tSQLt? CREATE OR ALTER PROCEDURE [test abc].[test abc1] AS BEGIN — Arrange EXEC tSQLt.FakeTable ‘dbo’, ‘table1’; –…

How to find the average distance between the locations

I have a table with source, destination and distance between the locations like as below i want to calculate average distance between the locations like, for example if we take A to B route 1: 21 miles, route 2: 28 miles, route 3: 19 miles I am expecting results: A to B –> 22.66 miles Thanks Answer B…

Using ISNULL or COALESCE on date column

I’ve got a date column where some rows have got NULL values. I would like to use ISNULL or something like that to substitute those values with something like ‘N/A’, however, when I try to use ISNULL, I get an error due to two different data types. If I try to convert my Date column to VARCHAR in order to…