Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2010-05-11 : 10:53:51
|
| Is it possible i want to use this select as in query in SP, is it possible if record dataid is returned then show true otherwise false:(select TOP 1 docid from TABLe_DocRepository where modulerecordid=RV.RevID and modulename='LM') DocIDThank you very much for the helpful info. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-05-11 : 10:59:51
|
| If exists((select TOP 1 docid from TABLe_DocRepository where modulerecordid=RV.RevID and modulename='LM') select 'true'elseselect 'false'MadhivananFailing to plan is Planning to fail |
 |
|
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2010-05-11 : 11:09:04
|
| Thanks Madhivanan,But how can i use the if exists condition within the select statement as an inquery:ALTER PROCEDURE [dbo].[USP_GetLMGridRevs](@LMid int)ASDECLARE @ErrorCode intSET NOCOUNT ONSELECT @ErrorCode = @@ErrorIF @ErrorCode = 0BEGIN SELECT RV.RevID, rtrim(RV.RevNo) as RevNo, RV.RevStatus, CONVERT(varchar(10),RV.RevisionDate,101) as RevisionDate, CONVERT(varchar(10),RV.IssuedDate,101) as IssuedDate, CONVERT(varchar(10),RV.LoggedDate,101) as LoggedDate, PV.PValue from TAB_ccsNetDMRevision RV, TAB_ccsNetPicklistValue PV Where RV.LMid=@LMid and RV.RevStatus = PV.Pickid ORDER BY RV.RevisionDate DESC SELECT @ErrorCode = @@ErrorENDSET NOCOUNT OFFRETURN @ErrorCode |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-05-12 : 03:12:10
|
| See my previous reply and apply that logicMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|