0

I'm trying to write a query that initializes the database and tables for an application I'm creating. It starts out like

CREATE DATABASE snakedb; 

USE snakedb; 

CREATE TABLE scores ( id int NOT NULL PRIMARY KEY,
                      name VARCHAR (50) NOT NULL 
                    );

CREATE TABLE gamelogs ( scoreid INT NOT NULL FOREIGN KEY REFERENCES scores(id) ON DELETE CASCADE, 
                        logtxt VARCHAR (8000)
                       ); 

and won't execute because

Msg 911, Level 16, State 1, Line 3
Database 'snakedb' does not exist.
Make sure that the name is entered correctly.

What should I be doing instead?

0 Answers0