[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Error - Could not locate entry in sysdatabases for database ...

gv

3/29/2007 3:10:00 PM

Hello all,

Using SQL 2000 sp4

I keep getting this error on this code:

Server: Msg 911, Level 16, State 1, Line 2
Could not locate entry in sysdatabases for database 'tot'. No entry found
with that name. Make sure that the name is entered correctly.

USE MASTER
IF NOT EXISTS(SELECT NAME FROM SYSDATABASES WHERE NAME = 'tot')
BEGIN
CREATE DATABASE TOT
END
GO

USE tot
--I now check for tables and if not there I create them.


Makes since to me I check if a database is there if not I create it. I then
switch to use the database I just created.

Why? And how can I do this?


thanks
gv


2 Answers

Immy

3/29/2007 3:21:00 PM

0

I have the same evnironment as you and it works for me.
You'd get that error if you were only 'parsing' the SQL and not actually
executing it!

Immy


"gv" <viator.gerry@gmail.com> wrote in message
news:e%239UXShcHHA.4260@TK2MSFTNGP02.phx.gbl...
> Hello all,
>
> Using SQL 2000 sp4
>
> I keep getting this error on this code:
>
> Server: Msg 911, Level 16, State 1, Line 2
> Could not locate entry in sysdatabases for database 'tot'. No entry found
> with that name. Make sure that the name is entered correctly.
>
> USE MASTER
> IF NOT EXISTS(SELECT NAME FROM SYSDATABASES WHERE NAME = 'tot')
> BEGIN
> CREATE DATABASE TOT
> END
> GO
>
> USE tot
> --I now check for tables and if not there I create them.
>
>
> Makes since to me I check if a database is there if not I create it. I
> then switch to use the database I just created.
>
> Why? And how can I do this?
>
>
> thanks
> gv
>
>


gv

3/29/2007 3:47:00 PM

0

ahh, ok

I'm so use to just parsing first and not running tell I have know errors.
still don't understand why SQL doesn't check this in parsing engine.

thanks
gv


"Immy" <therealasianbabe@hotmail.com> wrote in message
news:OREwYXhcHHA.4352@TK2MSFTNGP03.phx.gbl...
>I have the same evnironment as you and it works for me.
> You'd get that error if you were only 'parsing' the SQL and not actually
> executing it!
>
> Immy
>
>
> "gv" <viator.gerry@gmail.com> wrote in message
> news:e%239UXShcHHA.4260@TK2MSFTNGP02.phx.gbl...
>> Hello all,
>>
>> Using SQL 2000 sp4
>>
>> I keep getting this error on this code:
>>
>> Server: Msg 911, Level 16, State 1, Line 2
>> Could not locate entry in sysdatabases for database 'tot'. No entry found
>> with that name. Make sure that the name is entered correctly.
>>
>> USE MASTER
>> IF NOT EXISTS(SELECT NAME FROM SYSDATABASES WHERE NAME = 'tot')
>> BEGIN
>> CREATE DATABASE TOT
>> END
>> GO
>>
>> USE tot
>> --I now check for tables and if not there I create them.
>>
>>
>> Makes since to me I check if a database is there if not I create it. I
>> then switch to use the database I just created.
>>
>> Why? And how can I do this?
>>
>>
>> thanks
>> gv
>>
>>
>
>