SQL Puzzles

SQLServerCentral Article

Finding Primes

  • Article

While it's not likely that many of you need to find prime numbers using T-SQL, it is an interesting programming exercise. SQL Server guru Kathi Kellenburger brings us one solution after taking a break over the holidays and reading some popular fiction.

4.33 (6)

You rated this post out of 5. Change rating

2008-01-01 (first published: )

7,352 reads

SQLServerCentral Article

SQL 2000 DBA Toolkit Part 3

  • Article

Phonetic matching, working on finding terms that are misspelled, is an art and there are a number of ways to handle it. In SQL Server 2000 the tools are limited, but Michael Coles brings us part 3 of his toolkit with some handy functions that can help you with text searching.

You rated this post out of 5. Change rating

2006-04-27

16,842 reads

SQLServerCentral Article

Practical Uses of PatIndex

  • Article

String manipulation is not one of the strong points of T-SQL, but there are some functions that can greatly assist you with searching and working with character values. New author Robert Davis brings us a look at PATINDEX, one of the search functions and also explains the differences between it and the often used CHARINDEX.

4.5 (6)

You rated this post out of 5. Change rating

2006-02-06

20,354 reads

SQLServerCentral Article

Eliminating Cursors

  • Article

T-SQL does some things wonderfully, but cursors are the bane of the language, often causing performance issues. Changing your queries around to remove cursors can be tricky and new author Kamran Ali brings us one technique he has used to dramatically improve performance.

3.67 (81)

You rated this post out of 5. Change rating

2008-06-13 (first published: )

55,124 reads

SQLServerCentral Article

The GO Command and the Semicolon Terminator

  • Article

There are probably not many SQL Server DBAs that use the semicolon as a statement separator. In SQL Server 2005, this is required in certain places and new author Kenneth Powers brings us a look at where and why you need to use this syntax.

4.23 (22)

You rated this post out of 5. Change rating

2007-10-02 (first published: )

45,368 reads

Blogs

AI Step 1

By

As this is an Artificial Intelligence (AI) World, things are changing. We can see that...

Beginner’s Guide: Building a Dockerized Todo App with React, Chakra UI, and Rust for Backend

By

In a containerized app, React and Chakra UI provide a robust and accessible user...

A New Word: Nachlophobia

By

nachlophobia – n. the fear that your deepest connections with people are ultimately pretty...

Read the latest Blogs

Forums

identify consecutive records greater than 1

By HeftSteady

Hello I need help identifying all records that have consecutive hours (time in order)...

Call dynamic sql storedprocedure from SSIS execute sql task

By komal145

hi, I have a table called Rules Create table Rules ( Id int ,...

Migrating database with many orphan users.

By JasonO

I am currently upgrading a very old database running SQL Server 2008 to SQL...

Visit the forum

Question of the Day

The Funny SELECTs

What is returned from this query?

SELECT
  ( SELECT COUNT (*) FROM Sales.SalesOrderHeader AS soh
    WHERE soh.OrderDate >= '01/01/2011' AND soh.OrderDate < '01/01/2012') AS OrdersIn2011
, ( SELECT COUNT (*) FROM Sales.SalesOrderHeader AS soh
    WHERE soh.OrderDate >= '01/01/2012' AND soh.OrderDate < '01/01/2013') AS OrdersIn2012
, ( SELECT COUNT (*) FROM Sales.SalesOrderHeader AS soh
    WHERE soh.OrderDate >= '01/01/2013' AND soh.OrderDate < '01/01/2014') AS OrdersIn2013;

See possible answers