getting a simple query's number of rows retuned in a form I can use in an If statement within Stored proc

smcgover
smcgover used Ask the Experts™
on
I have to know if a select returns a row, if yes I will update, if now I will insert .
How do I access this, is there a sqlserver variable that will give me the rows returned in the query just run?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
@@rowcount
Top Expert 2010
Commented:
Awarded 2008
Awarded 2008
Commented:
if exists(select 1 from tablename)
begin
update query
end
else
begin
insert query
end

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial