You can create the user in Microsoft SQL Server & Microsoft Azure SQL Database using the following code.

  • Connect to master database and execute the following script:

    CREATE LOGIN UserNameHere WITH password='Password here';
    CREATE USER UserNameHere FROM LOGIN UserNameHere;
    
  • Then connect to the desired database and execute the following script:

    CREATE USER UserNameHere FROM LOGIN UserNameHere ;
    EXEC sp_addrolemember 'db_datareader', 'UserNameHere';
    
  • read more

    Recently we were in a situation where we need to merge data from our offline version of application with online database.
    We planned to use uniqueidentifier as data type for ID columns instead of int (auto identity).

    But when we looked at reviews a lot of people were against this idea, they said if we use uniqueidentifier column as primary key (and clustered index) then there will be lot of fragmentation in our database, also the extra size of key.

    Some people suggested that use the int type (auto identity) as primary key and add another column of uniqueidentifier type for this purpose. We decided to go with this idea and added a uniqueidentifier column in each table. read more