Christmas Queries

Christmas Queries
Download PDF

Here is a sample Christmas-themed query for SQL Server:

SELECT 'Merry Christmas!' AS greeting, GETDATE() AS current_date FROM sys.objects WHERE type = 'U' -- only select user tables AND OBJECT_ID(name) % 2 = 0 -- only select tables with an even object ID AND DATEPART(DAY, current_date) = 25 -- only select tables on December 25th

This query returns the greeting “Merry Christmas!” and the current date. It only selects user tables that have an even object ID and are accessed on December 25th, which is Christmas Day.

Here is an example of the output of this query:

greeting current_date

Happy Holidays to all!

 

More from Stedman Solutions:

SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!

Leave a Reply

Your email address will not be published. Required fields are marked *

*