Posted by Razvan Socol on 02/22/06 21:40
Hello, KR
You can use one of the following:
IF EXISTS (
SELECT *
FROM master.dbo.sysdatabases
WHERE name = @chvnNewDatabaseName
)
SET @boolDatabaseExists = 1
ELSE
SET @boolDatabaseExists = 0
or:
SET @boolDatabaseExists = CASE
WHEN EXISTS (
SELECT *
FROM master.dbo.sysdatabases
WHERE name = @chvnNewDatabaseName
) THEN 1 ELSE 0 END
or:
SET @boolDatabaseExists = (
SELECT COUNT(*)
FROM master.dbo.sysdatabases
WHERE name = @chvnNewDatabaseName
)
Razvan
Navigation:
[Reply to this message]
|