Follow

SQL Snippets

Attached to this post you will find some SQL snippets for use in TX DWA. SQL snippets are small pieces of SQL code that can be used throughout your project to speed up development. Below are some examples of what SQL snippets can be used for.

  • Field level transformations
  • Views
  • Stored procedures
  • User Defined functions
  • Script actions

Please be aware that it is the content of the individual SQL snippet that determines its suitable usage.

In the attached XML file you will find the following snippets:

Data and Time:

  • Current date - First date of future year
  • Current date - First date of last year
  • Current date - First date of month
  • Current date - First date of previous year
  • Current date - First date of year
  • Current date - Last date of month
  • DateDiff (variable end date)
  • DateDiff (fixed end date)
  • DateKey - Converts a datetime formatted field into an integer field for use as a better performing foreign key.
  • First date of future year
  • First date of last year
  • First date of month
  • First date of next year
  • First date of previous year
  • First date of year
  • Last date of month
  • Time Table: - Script action that populates a custom time dimension with 15 minute increments 

Concatenate:

  • Concatenate 2 Fields: Concatenates two fields separated by a space.
  • Concatenate 3 Fields: Concatenates three fields separated by a space. 
Was this article helpful?
4 out of 4 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.