Switch Case stmt!
-
Hi everOne I have used switch case statment before but not sure the way I want to use it is implementable or not. If it is then please could you convert the following code into switch Case statement. create proc Details_GetBYID ( @Id int, @TypeId nvarchar(max) ) AS IF @TypeId = 'P1' BEGIN SELECT motot.Completed,motot.Hours,motot.Subject FROM MasterT as motot INNER JOIN PSALevel as psal on psal.Id = motot.Id WHERE motot.Id = @Id END ELSE IF @TypeId = 'P2' BEGIN SELECT motot.Completed,motot.Hours,motot.Subject FROM MasterT as motot INNER JOIN PSALevel as psal on psal.Id = motot.Id WHERE motot.Id = @Id END ELSE BEGIN SELECT motot.Completed,motot.Hours,motot.Subject FROM MasterT as motot INNER JOIN PSALevel as psal on psal.Id = motot.Id WHERE motot.Id = @Id END any help would be appriciated. thanks in adv. regards learner
-
Hi everOne I have used switch case statment before but not sure the way I want to use it is implementable or not. If it is then please could you convert the following code into switch Case statement. create proc Details_GetBYID ( @Id int, @TypeId nvarchar(max) ) AS IF @TypeId = 'P1' BEGIN SELECT motot.Completed,motot.Hours,motot.Subject FROM MasterT as motot INNER JOIN PSALevel as psal on psal.Id = motot.Id WHERE motot.Id = @Id END ELSE IF @TypeId = 'P2' BEGIN SELECT motot.Completed,motot.Hours,motot.Subject FROM MasterT as motot INNER JOIN PSALevel as psal on psal.Id = motot.Id WHERE motot.Id = @Id END ELSE BEGIN SELECT motot.Completed,motot.Hours,motot.Subject FROM MasterT as motot INNER JOIN PSALevel as psal on psal.Id = motot.Id WHERE motot.Id = @Id END any help would be appriciated. thanks in adv. regards learner
-
Hi everOne I have used switch case statment before but not sure the way I want to use it is implementable or not. If it is then please could you convert the following code into switch Case statement. create proc Details_GetBYID ( @Id int, @TypeId nvarchar(max) ) AS IF @TypeId = 'P1' BEGIN SELECT motot.Completed,motot.Hours,motot.Subject FROM MasterT as motot INNER JOIN PSALevel as psal on psal.Id = motot.Id WHERE motot.Id = @Id END ELSE IF @TypeId = 'P2' BEGIN SELECT motot.Completed,motot.Hours,motot.Subject FROM MasterT as motot INNER JOIN PSALevel as psal on psal.Id = motot.Id WHERE motot.Id = @Id END ELSE BEGIN SELECT motot.Completed,motot.Hours,motot.Subject FROM MasterT as motot INNER JOIN PSALevel as psal on psal.Id = motot.Id WHERE motot.Id = @Id END any help would be appriciated. thanks in adv. regards learner