Back to General Tasks index
You can also search through flags as part of your searches using SQL. SQL searches will search for and
return flags as long decimal numbers that have been converted from binary - but you translate between these
numbers and the flag names with the functions dbo.fPhotoFlags and dbo.fPhotoFlagsN.
Go to the SQL Search tool (opens in new window), under the
Search menu. To get there from the astronomers' main page, look under Search Tools. To
get there from the public main page, look for Search under SkyServer tools.
To constrain your search based on flags, add one of the following to the WHERE block of your query:
To find only objects for which a certain flag is present:
WHERE (p.flags & dbo.fPhotoFlags('flag')) != 0
Replace flag with the name of the flag you want to search.
For example, this query will find IDs and positions of objects that have
been flagged as having moved:
SELECT objid, ra, dec |
FROM photoTag |
WHERE (flags & dbo.fPhotoFlags('MOVED')) != 0 |
To find only objects for which a certain flag is absent:
WHERE (p.flags & dbo.fPhotoFlags('flag')) = 0
Replace flag with the name of the flag you want to search.
For example, this query will screen out IDs and positions of objects that have
been flagged as not being saturated:
SELECT objid, ra, dec |
FROM photoTag |
WHERE (flags & dbo.fPhotoFlags('SATURATED')) = 0 |
The form below will let you practice searching for flags with SQL, using the example queries
on this page. Press Query 1 or Query 2 to load the queries, and Submit to
run the queries.
Next: Get objects with clean photometry
|