from what i have been told, this is suppose to be faster and more efficient.
i just like the fact that i don't have to declare variables. ;)

IF NOT EXISTS(
        SELECT UserName
        FROM EkSelfAssRpts
        WHERE UserName=@UsernameAux AND
        FirstName=@FirstNameAux  AND Title=@TitleAux
)
 begin

        your TSQL code  

 end

Anthony Petruzzi
Webmaster
954-321-4703
[EMAIL PROTECTED]
http://www.sheriff.org


-----Original Message-----
From: Shawn Grover [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 12:42 PM
To: CF-Talk
Subject: RE: RecordCount is 0 en Stored Procedure


If it's SQL Server, you can do it like this:


 SELECT UserName FROM EkSelfAssRpts
    WHERE  UserName=@UsernameAux AND
FirstName=@FirstNameAux  AND Title=@TitleAux

if @@RowCount = 0
begin
        ... do your action ...
end

Just keep in mind you have to check @@RowCount (and @@Error) immediately
after the operation in question - the next command resets these values.

Shawn Grover

-----Original Message-----
From: Mario Martinez R. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 10:31 AM
To: CF-Talk
Subject: RecordCount is 0 en Stored Procedure


Hi all:
I got this query in transac-SQL.
I would like to know when the result recorset is 0.
I wrote this tricky code down here but I think is
wrong.
Any ideas??.
Thanks in advance friends.
Mario


 SELECT @Count=COUNT(UserName) FROM EkSelfAssRpts
    WHERE  UserName=@UsernameAux AND
FirstName=@FirstNameAux  AND Title=@TitleAux

    IF  @Count=0
     BEGIN
      /*Here I write my action*/
     END


_________________________________________________________
Do You Yahoo!?
Informaci�n de Estados Unidos y Am�rica Latina, en Yahoo! Noticias.
Vis�tanos en http://noticias.espanol.yahoo.com


______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to