Primary key in a view | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Primary key in a view

I need to create 2 views and then join them to get all the columns into another view. can i create primary keys on both the views
both views have vendor_id as one column
that is the only column common in them view 1 has vendor_id, address, startdate, enddate, city, state vendor_id address startdate enddate city state
1 abc may 10 june 10 Kansas MO
view 2 has vendor_id, service offered, employee name view 2 will have multiple services and each vendor ID will have multiple employee who will offer multiple services as well so there will be repititons like this: Vendor ID EmployeeName Service Offered
1 Albert Tech Support
1 Albert Desktop Technician
1 Albert Lotus Notes Admin
2 Tony Developer
2 Tony Admin
which would be the best join to use. HOW DO I CHANGE MY VIEWS TO MAKE VENDOR_ID as primary keys in them
How would you like your 3rd VIEW ?
KH
Have a look at indexed views and see if that is really what you want (It’s what you are asking for). If this is performance related then anything accessing the views will use indexes on the underlying tables.
]]>