title: SQL Server 2008 R2: create login and user
body: <p>I'm using SQL Server 2008 R2 with Windows authentication and VB.net.</p>
  
  <p>I'm looking for help with a script where a new user through a front end add them self to the database by creating a new login on the server, and a user for a database on the server.</p>
  
  <p>I want it such that the user add in his name and it will do the rest, so the script I assume must either use the <code>'sa'</code> account or some other account to create the new login and user.</p>
  
  <p>I tried using a stored procedure but apparently it doesn't work with <code>CREATE LOGIN</code> etc.?</p>
  
  <p>Can anyone advise please.</p>