Monday, November 11, 2019

Can we pass parameters to a view in SQL?

A possible solution would be to implement a stored function, like:

CREATE FUNCTION v_student (@pintSno INT)
RETURNS TABLE
AS
RETURN
   SELECT * FROM Student WHERE stu_id=@pintSno ;


This allows you to use it as a normal view, with:

SELECT * FROM v_student (3)

No comments:

Post a Comment

Mixed Content: The page at xxx was loaded over HTTPS, but requested an insecure

 Mixed Content: The page at ' https ://www.test.com/signup.aspx' was loaded over HTTPS, but requested an insecure script ' http ...