Hi. I have this query
SELECT 'ALTER TABLE DOC_INVS_1 DROP CONSTRAINT ' + CONSTRAINT_NAME
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME = 'DOC_INVS_1'
and CONSTRAINT_NAME LIKE 'FK__DOC_INVS___kntr%'
Which returns a query like this:
ALTER TABLE DOC_INVS_1 DROP CONSTRAINT FK__DOC_INVS___kntr___2018A105
How to execute the returned query? I need to do it with another query (copy and paste to new query window is not an option)
I thought something like
EXEC (<the above query>)
But I guess there's some problems with the quotation marks or something else ? I've seen somewhere the prefix N`
which I guess is also used for escaping the quotation marks.
Thanks for the replies!