Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
and server name is ./sqlexpress

i know the program but don,t know actually where to write
actually i am creating stored procedure for checking existing data
when i write code on click of button it is giving me error of missing namespace or directive.
where to write stored procedure program

SQL
create procedure usp_QuestionAnswer
{
@question_id int=0 ,
@student_id int =0,
@answer varchar(500)=null
}
AS BEGIN
if not exists(select question_id from Answer where question_id = @question_id  and  student_id =@student_id  ) begin
   insert into Answer(question_id ,student_id,student_answer)
   values(@question_id ,@student_id,@student_answer)
 
end
 
END
Posted
Updated 20-Mar-14 5:29am
v3
Comments
Mike Meinz 20-Mar-14 11:28am    
Are you using SQL Server Management Studio? That is the program that most people use to write Stored Procedures. In SSMS, click on New Query and write your Stored Procedure.
swati gapat 20-Mar-14 13:14pm    
what is SSMS....
Mike Meinz 21-Mar-14 7:00am    
SQL Server Management Studio

You'll need to be more specific as to what you need to do with this question. However a quick look on CodeProject or your favourite search engine will point you in the right direction.

CodeProject - Sql Server - How to write a Stored procedure in Sql server[^]
 
Share this answer
 
Hi,

Open SQL server where you have create tables...
press ctrl+N there will be a new file having extension .sql
in this file write store procedure and press F5 to run/save...

Happy Coding!
:)
 
Share this answer
 

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