views:

26

answers:

1

Im having trouble identifying my databases as correct and valid version of my model. I have a GUID-id for my model I could use, but where do I put it? I dont want an entire table with only one row for this GUID. Is there any metadata-repository for databases (SQL Server 2008) or is there any other methods of identifying databases except their names? I could name the database to my model-GUID but it doesnt seem right...

The scenario is like this: I have a Entity Framework-model and I identify it by a GUID. I let the user pick a database-connectionstring and now I want to verify that its a valid database (which has been created from my app). I want to do this every time the app starts just to be sure. What Im doing now is checking that a certain table with a certain name exists but thats not good enough. I want to be 99% sure.

Edit: I would prefer to set this value from the DDL-script which is already setting up the database and I want to be able to get it from a SqlCommand in ado.net.

A: 

Use an Extended database property

In script:

USE preet;
GO
EXEC sys.sp_addextendedproperty 
@name = N'myVersion', 
@value = N'999-abc-123-nop';
GO

and

alt text

In the UI

alt text

Preet Sangha
Spot on! Thanks!
Andreas Zita