Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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
SCRIPT

Effectively mapping primary key – foreign key relations

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

FORUM

Retrieving columns from related tables

Retrieving columns from related tables

FORUM

Derived Column Transformations - Performance-related

Derived Column Transformations - Performance-related

ARTICLE

Relational Database Without Relations

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

FORUM

Script Table As misses or missing a column

script table missing a column scripting, sql management studio,

Tags
miscellaneous    
t-sql    
 
Contribute