0

I get a syntax error with this TSQL:

if exists ( exec('select * from mytable') at LinkedOracleServer ) begin
    print 'rows exist'
end

I can't use INSERT EXEC into a temp table because the calling proc also uses INSERT EXEC and I get the error "An INSERT EXEC statement cannot be nested."

Is there another way to test for existing rows on a linked server?

1 Answer 1

1

It is just a suggestion. Can't you try like this

select @recod_count = count(*) from LinkedOracleServer.mytable
if @recod_count>1 begin
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.