我有一个动态内容调查问卷,我有需要与SQL提议的控件? 。在SQL Server的select语句中有动态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
我读的功能不是最好的解决方案什么是替代品? – Chaka 2013-03-02 21:34:08
这不是功能不好的解决方案;这是错误使用的功能是不好的解决方案。 – 2013-03-02 21:36:08
@Chaka。 。 。你的问题是什么?对于许多目的而言,一个函数恰好是您想要做的正确解决方案。 – 2013-03-02 21:55:06