Helpo! Tables in User Defined Functions

  • I can't seem to interpret the BOL's description of how to Add a Primary Key Constraint on a temp table I'm using in a UDF.  I want the Primary Key on two fields, however, the Standard way will not work...

    Ex. (NOTE:  THIS DOES NOT WORK!!!)
    Declare @Tmp Table(UserID UniqueIdentifier Primary Key, ActivityDate DateTime Primary Key)

    I need both of these fields as the Primary Key on this Temp Table.

  • Hi,

    Try this one...

    Declare @Tmp Table(UserID UniqueIdentifier, ActivityDate DateTime

     Primary Key (UserID, ActivityDate))

     


    Lucky

  • Great! That worked!!  I knew it was easy

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

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