Attached to this post you will find some SQL snippets for use in Discovery Hub.
Please note that they are provided as-is and with no guarantee that they will receive updates or work in all future versions of the software.
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
- 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 2 Fields: Concatenates two fields separated by a space.
- Concatenate 3 Fields: Concatenates three fields separated by a space.