I need to use exec
inside of select
clause. The query for the exec is created according to the columns of the table to on which select clause if used. What i want to do is something like following:
SELECT distinct
MTMain.[TableName],
MTMain.[TableFKey],
(select IsActive (exec GetStringForIsActive MTMain.[TableName],MTMain.[TableFKey]))
FROM
[MasterTableForLanguage] MTMain
Here, GetStringForIsActive
is the stored procedure I want to execute for every row selected from MasterTableForLanguage
.
The stored procedure
will use EXEC
to execute the following string
select IsActive from [TableName] where PKID= cast([TableFKey] as int)
TableName and TableFKey will be inputs of the stored procedure.