CREATE PROCEDURE StroGetReadSoSo
@gname nvarchar, @gcount nvarchar(10) output
AS
SELECT @gcount=COUNT(1) FROM Gname WHERE gname LIKE '@gname%'
GO
为什么统计时条数总为0
SELECT COUNT(1) FROM Gname WHERE gname like '植物%'
在查询分析器里正常
LIKE '@gcount%' 是什么意思,你想要查出什么样的数据?
我晕参数写错喽
CREATE PROCEDURE StroGetReadSoSo @gname nvarchar,@gcount nvarchar(10) output AS SELECT @gcount=COUNT(1) FROM Gname WHERE gname LIKE '@gname%' GO
@小小池:
CREATE PROCEDURE StroGetReadSoSo @gname nvarchar,@gcount nvarchar(10) output AS SELECT @gcount=COUNT(1) FROM Gname WHERE gname LIKE ''''+@gname+'%''' GO
试试