Usage of Table with single column (Identity)?
identity-column, sql-server
Solution
I think people use this to replicate Oracle's SEQUENCE. Basically they want a single unique identifier for any entity they create in their system, so they have something like this:
CREATE PROCEDURE dbo.GenerateIdentifier
@Identifier INT OUTPUT
AS
BEGIN
SET NOCOUNT ON;
INSERT dbo.SingleColumnTable DEFAULT VALUES;
SET @Identifier = SCOPE_IDENTITY();
END
GO
Now whenever they want to add a new contact, or customer, or order, etc. they first call this procedure and get the new identifier. Then only one entity in the system will have an identifier = 1, or 2, etc.
Problem
Whats the purpose of having single column table (identity column)? Is there a good use-case available? Is it really a good practice?