Monday, September 5, 2011

ElevateDB: Select TOP Equivelent

In my previous post ElevateDB: Date Math I discussed how to select internal constants and literals from within the ElevateDB Manager using a dummy table.

Well the ElevateDB boys have spoken and you do not need to create a dummy table to perfom this type of query. You can simply go against the information.tables. (I'll have to read up on these guys).

Anyway here is the suggested way to run the same query without using my dummy table approach:
select 
current_date as today 
from information.tables
This works great except it returns four rows in my environment. So, naturally the next question is how do you limit the results to produce only one row.

From MS SQL Query Analyzer you just use the keyword TOP 1. In EDB it's slightly different:
select 
current_date as today 
from information.tables 
range 1 to 1

Semper Fi
Gunny Mike

No comments:

Post a Comment