Using a user-defined type as a primary key
Suppose I have a system where I have metadata such as:
table:
======
key
name
address
...
Then suppose I have a user-defined type described as so:
datasource
datasource-key
A) are there systems where it's possible to have keys based on user-defined types?
B) if so, how do you decompose the keys into a form suitable f开发者_运维知识库or querying? C) is this a case where I'm just better off with a composite primary key?Use a composite primary key if this is what the model says
- if you have to decompose into components to query then you've already killed performance
- any opaque user defined type may give false duplicates because 2 different inputs may give same output
I've not tried it, but SQL Server will probably allow it. However, a primary key is an index so it may not, definitely not if the user type is neither deterministic nor schemabound
Although, I think I'm mixing up types and udfs in my thinking...
精彩评论