0

我有一份动态内容调查表,并且我有需要使用 SQL 进行推广的控件?

我试图从表中选择Questionnaire并运行存储在下面“PrepopulateContentSQL”列中的 SQL 语句。查询返回单个值。

前任:

Select name from Agency

我的桌子Questionnaire

QuestionID int 
Required bit
Data_Type int
Control_Type int 
Data_Choices nvarchar
Data_Max_Length int  
Question_Group_Id int
Question_Label nvarchar
Question_Order int  
PrepopulateContentSQL nvarchar
PrePopulated bit

我在想也许是一个功能?

Select 
    QuestionID, Required, Control_Type, Data_Choices, 
    GetPrepopulated(PrepopulateContentSQL) As PreValue
From 
    Questionnaire
4

1 回答 1

0

您确定要存储每次执行的 sql 字符串吗?如果它们像“从机构中选择名称”一样简单,我想它们可以很容易地实现为类似宏的系统,您可以在其中预定义许多查询,而预填充列可以简单地保存一个参考.

这将为您提供更多安全性(因为您不再需要过多担心该 sql 的内容),并且可能为您提供自定义 UI 以显示 @AgencyName 而不是“从代理机构中选择名称”的范围

只是一个想法...

于 2013-03-02T21:59:50.167 回答