如何显示用于获取 SQL Server 中参数值的对话框?
例如查询中有两个参数,@Name
和@Family
;现在,我得到两个对话框而不是使用 SET。
示例:
DECLARE @Name VARCHAR(50);
SET @Name = 'Chad';
SELECT *
FROM tbl
WHERE Name = @Name;
我的意思是,我不想使用 SET @Name = 'Chad'
设置 @Name
的值,而是显示一个对话框来获取以下值:来自用户的该参数,然后将其设置为 @Name
。
最佳答案
您可能想要template parameters :
SELECT *
FROM tbl
WHERE Name = <Name, VARCHAR(50),'default_value'>;
Docs :
The Specify Values for Template Parameters dialog is a grid with three columns. The Parameter and Type columns are read-only and cannot be changed. Review the contents of the Value column, and change any of the defaults to values appropriate for your implementation.
To use this dialog box, you must have parameters in your script enclosed in angle brackets (< >) in the format: parameter_name, data_type, default_value.
关于sql - 如何在 SQL Server 中显示获取参数值的对话框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46871050/