cnd
cnd

Reputation: 33784

nvarchar to SQL

can I convert nvarchar(max) to sql ?

like here

SELECT [RecTime], [Name],
   CAST(CASE WHEN 
    -- <logics>
    EXEC([SQL]) -- Or NvarcharToSql ...
    -- </logics>
   THEN 1 ELSE 0 END AS bit) AS [Value]
FROM EventIncidentsStates
GROUP BY [RecTime], [Name], [SQL]

and sql contains sql logics ...

Upvotes: 0

Views: 81

Answers (1)

gbn
gbn

Reputation: 432667

No. You can't embed a stored proc call or EXEC in a SELECT

You can use a scalar udf is you don't care about performance, but not if it is dynamic SQL

You'd have to loop or some such: but it isn't clear what you're trying to do. You asked how to do your chosen solution, rather than stating your problem/requirement

Upvotes: 3

Related Questions