Select single id from NULL We are having a database full with set ID's. To fill the database, we have to select one single ID every time. This may only be an ID where the rest of the values are set with NULL (empty).
How to do this?

SELECT `id` FROM `ids` WHERE `datetime` IS NULL


returns all empty ID's. I just have to select one of them at random.
In SQL Server, you can use TOP 1 and order by newid() to get a random row returned. As in:

SELECT TOP 1 id FROM ids WHERE datetime IS NULL ORDER by newid()