Last post Nov 14, 2018 09:41 AM by PatriceSc
Nov 14, 2018 05:26 AM|JagjitSingh|LINK
I want if query return records using Stored procedure then perform some calculation else perform some other calculation
Nov 14, 2018 09:41 AM|PatriceSc|LINK
What do you get from your SP ? You could use maybe :
--CREATE PROCEDURE sp_test AS SELECT 1 WHERE RAND()>=0.5
IF @@ROWCOUNT=0 PRINT 'DO SOMETHING' ELSE PRINT 'SOMETHING ELSE'
It sill returns the resultset. If it returns many rows I would change or would create another SP. Sometimes especially if unexperienced with Transact SQL, it's best to give more détails about the actual need so that one can suggest what could be done when
starting from 0.
Here this is a minimal amount assuming for example you can't change the SP at all and need to reuse it (and you don't need what it returns ?)