Say, I just created a database, then created a login and and now I need to assign a user to it. So I do:
CREATE DATABASE [testdb2] COLLATE SQL_Latin1_General_CP1_CI_AS;
CREATE LOGIN testusr1 WITH PASSWORD = 'mystrongpassword';
USE [testdb2];
CREATE USER testusr1 FOR LOGIN testusr1;
But the USE
line returns this error:
Database 'testdb2' does not exist. Make sure that the name is entered correctly.