HI all,
From http://www.c-sharpcorner.com/, I copied the following code:
-- scStoredProc_1.sql from c-sharpconner -- 27 August 2015 15.17 PM USE hidDB; GO -- Creation of emp table: create table emp(empId int, empName varchar(15), empAge int ) -- Inserting values insert into emp select 1,'deepak',21 union all select 2,'Arora',21 union all select 3,'Vandna',22 --Creation of emp1 table create table emp1(empId int,empAdd varchar(35)) --Inserting the value insert into emp1 select 1,'delhi'union all select 2,'banglore'union all select 3,'usa' -- getting output select * from emp1 --Non-parameterized Stored Procedure for Showing All Records create proc usp_select as select * from emp -- getting output exec usp_select --Non-parameterized Stored Procedure for Join: create proc usp_join as select e.empId,e.empName,e.empAge,e1.empAdd from emp e inner join emp1 e1 on e.empId=e1.empId -- getting output exec usp_join --//// Parameterized Stored Procedure for Insert //// create proc usp_insert(@id int,@name varchar(15),@age int) as insert into emp values(@id,@name,@age) --/// getting output //// exec usp_insert 4,'Ankit',19 exec usp_select --/// Parameterized Stored Procedure for Update //// create proc usp_update(@id int,@name varchar(15),@age int) as update emp set empName=@name,empAge=@age where empId=@id --/// getting output /// exec usp_update 4,'Mohan',20 exec usp_select --\\\\\\ Parameterized Store Procedure for delete \\\\\\ create proc usp_delete(@id int) as delete from emp where empId=@id --\\\ getting output \\\\\ exec usp_delete 4 exec usp_select
I executed the code in my Microsoft SQL Server 2012 Management Studio (SSMS2012). It worked and Messages said: Command(s) completed successfully. But, I did not get the output of the Non-Parameterized and Parameterized Stored Procedures listed in the left-handed-side of the Messages!!?? I don't know why and how to fix them. Please kindly help, advise and respond.
Thanks in advance,
Scott Chang
- Edited by Scott H Chang 10 hours 46 minutes ago