问题描述
我声明了一个变量并希望通过选择查询设置它的值。
i有一张表:
fileNameGenerator
______________________
(pk)fileSymbol | bc
这是我的sp:
i declared a variable and want to set it's value by way of a select query.
i have a table:
fileNameGenerator
______________________
(pk)fileSymbol | bc
here's my sp:
alter procedure bcSymbol
(
@bc decimal(18,15)
)
AS
/* SET NOCOUNT ON */
Declare @bcSymbol varchar(50)
Select @bcSymbol = (SELECT fileSymbol From fileNameGenerator WHERE bc = @bc)
RETURN
出于某种原因,这是我得到的输出...
运行[dbo]。[ bcSymbol](@ bc = 8.550000000000000)。
没有行影响。
(0行返回)
@RETURN_VALUE = 0
完成运行[dbo]。[tempFileName]。
i不明白为什么我不是得到正确的符号。我从表本身复制了bc值。输出应该是一个1根据table.s
for some reason, this is the output i get...
Running [dbo].[bcSymbol] ( @bc = 8.550000000000000 ).
No rows affected.
(0 row(s) returned)
@RETURN_VALUE = 0
Finished running [dbo].[tempFileName].
i don't understand why i'm not getting the proper symbol back. i copied the bc value in from the table itself. the output should have been a 1 according to the table.s
推荐答案
ALTER PROCEDURE bcSymbol
@bc decimal(18,15)
AS
BEGIN
SELECT fileSymbol
FROM fileNameGenerator
WHERE bc = @bc
END
这篇关于sproc没有设置声明变量的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!