Click here to Skip to main content
15,878,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
sir,
bellow is my example code for creating view in sql.but its generates error, please help me to fix the error.if any one knows the answer please help me...
CREATE VIEW HR AS SELECT First_Name FROM HR_EMP_MASTER WHERE Emp_Id=@p_emp_id;
Posted
Comments
OriginalGriff 7-Dec-13 4:20am    
What error does it generate?
[no name] 7-Dec-13 5:05am    
What is the error..??
RAHUL(10217975) 7-Dec-13 5:37am    
Error Might be @p_emp_id not declare ...:D
Amir Mahfoozi 8-Dec-13 0:53am    
Please read here : http://stackoverflow.com/questions/1687279/can-we-pass-parameter-to-a-view-in-sql

syntax for craete view
SQL
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
eck t
you can check both field "Emp_Id=@p_emp_id"whether present or not .
 
Share this answer
 
CREATE VIEW HR
AS
DECLARE @p_emp_id int
SELECT First_Name FROM HR_EMP_MASTER
WHERE Emp_Id=@p_emp_id


Try this, and your error will be resolved...
 
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