Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
ProfileID	                     Profile	        
0	                             Super Admin	 
2378	                             Admin	         
2379	                             Software Engineer 
2380	                             Program Manager	  
2381	                             Project Manager	 
2382	                             Tech Lead	 
2383	                             Tester     	  
2384	                             DBA	        
2385	                             Onsite Project Manager	
2386	                             Account Manager	
2387	                             HRM	         
2388	                             NOC Support	
2389	                            QA Manager	
2390	                            Trainee        	
2391	                            Business Development Manager 
2392	                            Business Development Team    
2393	                            Team Lead	
2394	                            Process Head	
2395	                            IT Administration 
2396	                            NOC Trainee     
2397	                            Technical Architect	
2398	                            DB Developer	
2399	                            NOC Team Lead	
2400	                            Content Writer
Posted
Updated 12-Jan-14 21:41pm
v4
Comments
Member 10501509 13-Jan-14 2:27am    
if profile='software engg' then display higher profile than software engg
Peter Leow 13-Jan-14 2:44am    
First of all, how do you differentiate hierarchy of profile? e.g. software engineer vs trainee, common sense will tell but not to a computer.
Member 10501509 13-Jan-14 2:48am    
By using profileID s
Peter Leow 13-Jan-14 2:49am    
No can do. e.g. the profileID for software engineer, project manager, and trainee are 2379, 2381, and 2390.
Member 10501509 13-Jan-14 2:51am    
if ProfileID=2379 then display remaining ProfileID

1 solution

If I understand you correctly now, you want to retrieve detail of a profile id, but if the profile id is 2379, then show all profile id other than 2379, right? Then may be the following stored procedure will help, or you can adapt it:
SQL
CREATE PROCEDURE spGetProfile
(
   @para int
)
AS
DECLARE @tmpType VARCHAR(15)
BEGIN
IF(@para = 2379)
    BEGIN
    SELECT * FROM tablename WHERE profileid <> @para
    END
ELSE
    BEGIN
    SELECT * FROM tablename WHERE profileid = @para
    END
END

then call this procedure like this:
EXEC dbo.spGetProfile  @para = 2378;

or
EXEC dbo.spGetProfile  @para = other profile id;
 
Share this answer
 
v3
Comments
Member 10501509 13-Jan-14 2:55am    
you correct for single profileID every time will pass different profileIDs for that i need query by using if or case

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900