Skip to content

sliekens/sqlhelpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

SQL Helpers

This repository contains T-SQL functions that help migrate databases to newer versions. The functions provide a simple API for checking whether objects exists and whether they have constraints.

Project Goals

My goal is to provide a simplish way to check the state of your database.

Previously, you would write code like this to check if a table exists (and drop it when it does):

IF OBJECT_ID('dbo.Scores', 'U') IS NOT NULL 
  DROP TABLE dbo.Scores;

That's kind of hard to read and even harder to remember. ('U' is for 'Table', duh doy!)

Instead you should be able to write this:

IF TableExists('dbo.Scores')
    DROP TABLE dbo.Scores;

Instalation instructions

Run the scripts from this repository on your database to create the helper functions. When newer versions become available, you can safely update to the latest version by running the new scripts.

Available Functions

Click on a function name to go to its page on the wiki.

About

Just a bunch of SQL Server migration helper functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published