[英]SQL Server 2008 Management Studio - Running Parameterized Query
I'd like to be able to run an already parameterized query from within the SSMS: 我希望能够在SSMS中运行已经参数化的查询:
select name
from aTable
where id = @id
I know that other IDEs (eg TOAD) allow for parameter binding - is this available in SSMS 2008? 我知道其他IDE(例如TOAD)允许参数绑定 - 这在SSMS 2008中是否可用?
Thanks! 谢谢!
I don't believe this is possible. 我不相信这是可能的。
What I usually do in this case is just add the following to the top of the window: 在这种情况下我通常做的只是将以下内容添加到窗口的顶部:
declare @id int
set @id = 10
-- followed by the parameterized query
Actually, I think 2008 supports initialization now: 实际上,我认为2008现在支持初始化:
declare @id int = 10
I would typically use the CTRL-Shift-M
functionality in SSMS. 我通常会在SSMS中使用CTRL-Shift-M
功能。 See following example with instructions. 请参阅以下示例和说明。 Bit tedious but hey, better than nothing. 有点乏味但嘿,总比没有好。
--===============================================
-- Purpose: Search all objects for specified Text
--===============================================
-- Instructions: CTRL-A + CTRL-Shift-M, enter text
-- to search, click Ok and press F5.
-- To repeat search with other text: CTRL-Z (undo)
-- and then repeat above.
SELECT o.Name AS [Object Name]
,o.xType AS [Object Type]
,s.TEXT AS [Object Text]
FROM sySobjects o,
sysComments s
WHERE o.Id = s.Id
AND TEXT LIKE '%<Text To Search,,>%'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.