Friday, July 06, 2007

Summer SQL Teaser Non Existing Database

Here is a simple teaser, BTW I assume you don't have a database named WasabiDb or do you?


USE WasabiDb
IF @@Error <> 0
PRINT 'db doesn''t exist'


USE WasabiDb
GO
IF @@Error <> 0
PRINT 'db doesn''t exist'

If you would run this in one shot (hit F5) how many of the error messages below will you see

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


And how many 'db doesn't exist' messages will you see

No comments:

Post a Comment