|
Posted by KR on 02/22/06 21:12
Hi,
I am trying to get a 0 or 1 depending on the sucess or failure of a
t-sql statement, and here is what I have:
Declare @boolDatabaseExists bit
Declare @chvnNewDatabaseName nvarchar(260)
SET @chvnNewDatabaseName = 'NewDatabase'
SET @boolDatabaseExists =
(
SELECT (1)
FROM master.dbo.sysdatabases
WHERE name = @chvnNewDatabaseName
)
Print @boolDatabaseExists
What it is doing right now is that it prints a 1 for when there is a
match for the @NewDatabaseName in the sysdatabases table. If there is
not a match, then there is no value set for @ boolDatabaseExists
What I would like it to do is if there is no match for the
@NewDatabaseName in the sysdatabases, I would like to set the
boolDatabaseExists to 0
I hope I am clear in my explanation.
Thank you
KR
Navigation:
[Reply to this message]
|