Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Build DATELOOKUP table

By YSLGuru,

This script creates a table named DATELOOKUP which is used for looking up date related values. Each record represents date related info about the date in the column dtDate. For example the iMonth column stores the integer value of the month of dtDate and sShortMonth stores the abbreviated name of that same month. Use this table in a join to get any kind of date related info about a specific date that would normally require the use of an SQL function.

The script includes syntax for populating the table. The script also adds extended properties to each column that includes details on what that columns valule is.

Total article views: 179 | Views in the last 30 days: 1
Related Articles

Effectively mapping primary key – foreign key relations

This script maps the primary key - foreign key relations regardless if the column names are the same...


Retrieving columns from related tables

Retrieving columns from related tables


Derived Column Transformations - Performance-related

Derived Column Transformations - Performance-related


Relational Database Without Relations

The strength and holy grail of relational databases lies in the very name: relations. Microsoft has ...


Script Table As misses or missing a column

script table missing a column scripting, sql management studio,


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones