RE: RecordCount is 0 en Stored Procedure

2002-04-18 Thread Tony_Petruzzi

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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: RecordCount is 0 en Stored Procedure

2002-04-18 Thread Shawn Grover

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

__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: RecordCount is 0 en Stored Procedure

2002-04-18 Thread Voris, Jim

Your problem is that if no records exist then @count NULL, not 0.

Try this. 

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

-Original Message-
From: Mario Martinez R. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 12:31 PM
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!?
Informacion de Estados Unidos y America Latina, en Yahoo! Noticias.
Visitanos en http://noticias.espanol.yahoo.com

__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RecordCount is 0 en Stored Procedure

2002-04-18 Thread Mario Martinez R.

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
__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists