Can we pass a parameter to a view in Microsoft SQL Server?
I tried to create view
in the following way, but it doesn\'t work:
create o
no. if you must then use a user defined function to which you can pass parameters into.
I have an idea that I haven't tried yet. You can do:
CREATE VIEW updated_customers AS
SELECT * FROM customer as aa
LEFT JOIN customer_rec as bb
ON aa.id = bb.customer_id
WHERE aa.updated_at between (SELECT start_date FROM config WHERE active = 1)
and (SELECT end_date FROM config WHERE active = 1)
Your parameters will be saved and changed in the Config table.