locked
Primary Keys RRS feed

  • Question

  • Is there still a requirement for primary keys to be lowercase "id" or has this changed ?
    Monday, April 28, 2014 3:26 PM

Answers

  • Hi ,

    When we use an Azure SQL table seamlessly with Mobile Services, the table must have an identity column called ‘id’ and it must be all lower case letters. For more information, you can review the article about using an existing Azure SQL table with Windows Azure Mobile Services.

    However, if you just create a Windows Azure SQL database table,  there is no requirements for primary keys to be lower case "id”. Windows Azure SQL Database doesn’t support Heap Tables. Thus creating tables in Windows Azure SQL Database requires Clustered Indexes. By default Windows Azure SQL Database creates the Clustered Index on the table’s Primary Key. There is an example, you can refer to it.

        CREATE TABLE [dbo].[TestTable] (
    
        [Id]        UNIQUEIDENTIFIER NOT NULL,
    
        [FirstName] NVARCHAR (10)    NOT NULL,
    
        [LastName]  NVARCHAR (10)    NOT NULL,
    
        [Type]      INT              NOT NULL,
    
        [Timestamp] ROWVERSION       NOT NULL,
    
    PRIMARY KEY (Id));
    

    For more information, see: CREATE TABLE (Azure SQL Database)

    http://msdn.microsoft.com/en-us/library/ee336258.aspx

    Regards,
    Sofiya Li


    Sofiya Li
    TechNet Community Support

    Tuesday, April 29, 2014 3:30 AM