Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 T-SQL cant create a database and use it right away

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-01-04 : 14:31:53
Hi I run this script:
create database mosaikDB2
use mosaikDB2

but it returns this error:
Msg 911, Level 16, State 1, Line 2
Could not locate entry in sysdatabases for database 'mosaikDB2'. No entry found with that name. Make sure that the name is entered correctly.

The problem is that I have no database called mosaikDB2.
If i run only create database mosaikDB2, it works without a problem
pls try it: try creating any new database and using it right away u ll get an error.
what should i do to avoid this.
Thanks a lot.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-01-04 : 15:05:10
Put a GO statement in between.

Tara Kizer
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-01-04 : 16:14:51
amazing, what does Go do amigo
Thanks a lot
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-01-04 : 16:16:25
also what do these commands do pls:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
Muchas gracias
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-01-04 : 16:19:37
Please look them up in SQL Server Books Online. It is explained in there.

Tara Kizer
Go to Top of Page
   

- Advertisement -