|A) EXEC sp_defaultdb 'Andrew','FinanceData'||B) GRANT ALL ON FinanceData TO Andrew|
|C) EXEC sp_addlogin 'Andrew'||D) EXEC sp_grantdbaccess 'FinanceData','Andrew'GOsp_addrolemember 'db_datareader','Andrew'|
Error 208 produces the message 'Invalid object name' and occurs when an object that does not exist in the current database is referenced. If the object exists in another database, we must use the USE statement to explicitly switch the context to the correct database or we must qualify the object name with the database name. A third option is to use the sp_defaultdb stored procedure. This stored procedure is used to change the default database for a login. When a client connects with SQL Server, the default database defined for its login becomes the current database without an explicit USE statement. The default database can be defined when the login is added with
sp_addlogin. When executing sp_addlogin the master database is the default database if a database is not specified. In this scenario a SQL Server 2000 login and a user account has been created for Andrew and he has been given database access and the required permissions.