Primary Key on the View

  • Hi guys

    Can we create Primary_Key Constraints on the View?

    If Not Is there any other solution for this to get Sequences??

  • Your question is a bit vague. Primary Keys and Sequences don't have much to do with one another.

    Are you talking about adding the equivalent of an IDENTITY column to a view?

    You could take a look at the ROW_NUMBER() function - you'd want to make sure that your ordering columns are unique and unchanging or the row number values may change between multiple selects...

  • You can create a UNIQUE INDEX on a view.

    I don't understand how sequences relate to this topic, though. Can you clarify please?

    -- Gianluca Sartori

  • farooq.hbs (8/8/2012)


    Hi guys

    Can we create Primary_Key Constraints on the View?

    If Not Is there any other solution for this to get Sequences??

    Please read the following, it discusses Indexed Views:

    http://msdn.microsoft.com/en-us/library/ms191432(v=sql.100).aspx

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply