怎么在sql2008中添加带参数的视图,把存储过程改成视图。比如

2025-01-02 09:21:47
推荐回答(1个)
回答1:

视图不能带参数的,你可以先创建视图,在视图里面用where

CREATE VIEW 视图名称
AS
SELECT
NRequestItemno
,[ItemSource]
,[NRequestFormNo]
,[BarCodeFormNo]
,[TollItemNo]
,[formno]
,[ParItemNo]
,(select cname from testitem where itemno=a.paritemno) as itemnamecw
,(select orderno from testitem where itemno=a.paritemno) as orderno
FROM dbo.NRequestItem

select * from 视图名称
where nrequestformno=@nrequestformno