| SP Name | Input Parameters | Output Parameters | Functionality |
| Sp_Insurance_UsernameExists | @username nvarchar(50) | @returnValue int | Should check if the passed in username exists in the webcrendetials table. IF exists, return 1 otherwise return 0 |
| Sp_Insurance_InsertCustomer | All the columns of customer table except ID (as ID is an identity column) and also the columns of the Web Credentials table | @ID int | Should insert a row in the customer table and return the ID of the created row |
| Sp_Insurance_InsertCustomerOrder | All the columns from the order table and the ID of the customer who was inserted by the above stored proc. | @ID int | Insert the row in the order and return the order ID |
Need to set parameters in stored procedures of sql server
Hello,
I have task and i got struck with these SQL server Stored procedures. Am confused and not understanding on how to declare them and write the parameterss. Mainly the select statements for the functionality .
Please can one help me in writing these
following is the table showing stored procedures requirements

Dorababu MekaRank #457 · 5.5K reputationPosted Jul 3, 2015, 7:09 PM EDT
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Jul 3, 2015, 8:00 PM EDT
AS
BEGIN
DECLARE @EXIST INT;
SET @EXIST=( SELECT COUNT(*) from dbo.webcrendetials e where E.username = @username)
IF @EXIST> 0
SET @EXIST = 1
ELSE
SET @EXIST = 0
SELECT @EXIST;
END
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Jul 3, 2015, 8:31 PM EDT
CREATE PROC Sp_Insurance_InsertCustomer(@COL1 DATATYPE, @COL2 DATATYPE .............@COLn DATATYPE)
AS
BEGIN
INSERT INTO customer VALUES (@COL1,@COL2..........@COLn)
SELECT MAXI(ID) FROM customer
END
Abhi me7 reputationPosted Jul 3, 2015, 9:26 PM EDT
Abhi me7 reputationPosted Jul 3, 2015, 9:30 PM EDT
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Jul 3, 2015, 10:09 PM EDT
SET @EXIST = 1
ELSE
SET @EXIST = 0
Abhi me7 reputationPosted Jul 4, 2015, 6:37 AM EDT
?????? ???2 reputationPosted Jul 8, 2015, 3:54 PM EDT