Reply to Setting a value for a boolean

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация