user3735855
user3735855

Reputation: 144

SQL Agent job - no results, yet stored proc works

I have a SQL Agent Job which claims to succeed, however doesn't ACTUALLY do what it is supposed to do. If I run the script inside on its own it does generate results.

I am using SQL 2014. The scrip used/inside the agent job is:

IF OBJECT_ID('TEMPDB..##RCCON','U') IS NOT NULL DROP TABLE ##RCCON

SELECT top 10 R.RC_C__ID as ConsentId
,dbo.clr_RC_CON(R.RC_CON__ID,'','') AS RC_CON
INTO ##RCCON FROM  RC_CON R 

The script works independently, but as a JOB yields no results.

Any suggestions please? Cheers

Upvotes: 0

Views: 86

Answers (1)

John Cappelletti
John Cappelletti

Reputation: 82020

The ##RCCON evaporates when the SQL Agent Job is done. They only exist for the duration of the session.

Perhaps use [dbo].[RCCON] instead

Upvotes: 2

Related Questions