September 4, 2006 at 10:11 pm
hi
pls give me eg for case function with row count
eg: if the row count is >1 then HIGH <1 or zero low
---these r table and column for refernce--
DECLARE
@rc tinyint ,
@var varchar(50)
set @var = (SELECT emd.tpa_id
from dbo.EMPLOYER_DIVISION AS ED,EMPLOYEE_MISC_DATA AS EMD
where emd.tpa_id=ed.tpa_id
and
emd.empe_key=ed.division_key)
thanxs
india-bangalore
September 4, 2006 at 11:25 pm
The function @@ROWCOUNT is updated only and after every DML statement is execueted.. This function can be used in this way....
DECLARE @rc tinyint , @var varchar(50)
SELECT @var = emd.tpa_id from dbo.EMPLOYER_DIVISION AS ED,EMPLOYEE_MISC_DATA AS EMD
where emd.tpa_id=ed.tpa_id and emd.empe_key=ed.division_key
SET @rc = @@ROWCOUNT
PRINT @rc
Note, you've used a select statement which will result a subquery error if the table contains more than one record..
--Ramesh
--Ramesh
September 5, 2006 at 1:25 am
Also see this thread or topic
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=71510
N 56°04'39.16"
E 12°55'05.25"
September 5, 2006 at 6:01 am
I can't tell if you want "High/Low" returned as a literal or a boolean... this will do the boolean thing... let us know what you really need.
DECLARE @MyCase INT
... do something like a select, update, insert, delete...
SELECT @MyCase = SIGN(@@ROWCOUNT)
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply