Results 1 to 8 of 8

Thread: Problems Running a good stored procedure as a job

  1. #1
    Tom Bartos Guest

    Problems Running a good stored procedure as a job

    I wrote a Stored Procedure I wish to run as a job. It inserts data to a linked server. The stored procedure runs fine from the sql query analyzer but fails as a job. There are no permissions assigned to this stored procedure as I beleive it runs under the context of sa which has default access granted.

    Can someone give me some insite why this stored procedure won't run as a scheduled job?

    ALTER PROCEDURE tsul_insertintolinkedserver
    AS
    DECLARE @srvname varChar(20)
    SELECT @srvname = @@servername
    insert into THOMAS.tsnet.dbo.usagelog
    select id, tsgroup, account, error, failedpin, type, servername, ipbrowser, cid, logintime, expand , msgspresent, msgslistened, @srvname
    from usagelog
    where id >
    ( select max(id) from THOMAS.tsnet.dbo.usagelog
    where hostserver = @srvname
    )

    Thanks in advance-

  2. #2
    Ray Miao Guest

    Problems Running a good stored procedure as a job (reply)

    Do you have detailed error message?


    ------------
    Tom Bartos at 12/13/99 1:27:49 AM

    I wrote a Stored Procedure I wish to run as a job. It inserts data to a linked server. The stored procedure runs fine from the sql query analyzer but fails as a job. There are no permissions assigned to this stored procedure as I beleive it runs under the context of sa which has default access granted.

    Can someone give me some insite why this stored procedure won't run as a scheduled job?

    ALTER PROCEDURE tsul_insertintolinkedserver
    AS
    DECLARE @srvname varChar(20)
    SELECT @srvname = @@servername
    insert into THOMAS.tsnet.dbo.usagelog
    select id, tsgroup, account, error, failedpin, type, servername, ipbrowser, cid, logintime, expand , msgspresent, msgslistened, @srvname
    from usagelog
    where id >
    ( select max(id) from THOMAS.tsnet.dbo.usagelog
    where hostserver = @srvname
    )

    Thanks in advance-

  3. #3
    Tom Bartos Guest

    Problems Running a good stored procedure as a job (reply)

    The error message doesn't help alot but here it is.

    SQL Server Scheduled Job tsul_insertintolinkedserver' (0xF1DFC3FC6CA6D311A78B00105A5EAA5F) - Status: Failed - Invoked on: 12/12/99 9:40:52 PM - Message: The job failed. The Job was invoked by User sa. The last step to run was step 1 (tsul_insertintolinkedserver).
    ------------
    Ray Miao at 12/13/99 8:36:23 AM

    Do you have detailed error message?


    ------------
    Tom Bartos at 12/13/99 1:27:49 AM

    I wrote a Stored Procedure I wish to run as a job. It inserts data to a linked server. The stored procedure runs fine from the sql query analyzer but fails as a job. There are no permissions assigned to this stored procedure as I beleive it runs under the context of sa which has default access granted.

    Can someone give me some insite why this stored procedure won't run as a scheduled job?

    ALTER PROCEDURE tsul_insertintolinkedserver
    AS
    DECLARE @srvname varChar(20)
    SELECT @srvname = @@servername
    insert into THOMAS.tsnet.dbo.usagelog
    select id, tsgroup, account, error, failedpin, type, servername, ipbrowser, cid, logintime, expand , msgspresent, msgslistened, @srvname
    from usagelog
    where id >
    ( select max(id) from THOMAS.tsnet.dbo.usagelog
    where hostserver = @srvname
    )

    Thanks in advance-

  4. #4
    k Guest

    Problems Running a good stored procedure as a job (reply)

    my 2 cents.........
    not sure but did you check the simple stuff.... on the STEPS dialog box, the Database name is correct, and the type is "Transact-SQL"

    -k


    ------------
    Tom Bartos at 12/13/99 9:08:53 AM

    The error message doesn't help alot but here it is.

    SQL Server Scheduled Job tsul_insertintolinkedserver' (0xF1DFC3FC6CA6D311A78B00105A5EAA5F) - Status: Failed - Invoked on: 12/12/99 9:40:52 PM - Message: The job failed. The Job was invoked by User sa. The last step to run was step 1 (tsul_insertintolinkedserver).
    ------------
    Ray Miao at 12/13/99 8:36:23 AM

    Do you have detailed error message?


    ------------
    Tom Bartos at 12/13/99 1:27:49 AM

    I wrote a Stored Procedure I wish to run as a job. It inserts data to a linked server. The stored procedure runs fine from the sql query analyzer but fails as a job. There are no permissions assigned to this stored procedure as I beleive it runs under the context of sa which has default access granted.

    Can someone give me some insite why this stored procedure won't run as a scheduled job?

    ALTER PROCEDURE tsul_insertintolinkedserver
    AS
    DECLARE @srvname varChar(20)
    SELECT @srvname = @@servername
    insert into THOMAS.tsnet.dbo.usagelog
    select id, tsgroup, account, error, failedpin, type, servername, ipbrowser, cid, logintime, expand , msgspresent, msgslistened, @srvname
    from usagelog
    where id >
    ( select max(id) from THOMAS.tsnet.dbo.usagelog
    where hostserver = @srvname
    )

    Thanks in advance-

  5. #5
    Ray Miao Guest

    Problems Running a good stored procedure as a job (reply)

    Find detailed error message in sql server agent errorlog and/or steps detail page.


    ------------
    k at 12/13/99 9:39:11 AM

    my 2 cents.........
    not sure but did you check the simple stuff.... on the STEPS dialog box, the Database name is correct, and the type is "Transact-SQL"

    -k


    ------------
    Tom Bartos at 12/13/99 9:08:53 AM

    The error message doesn't help alot but here it is.

    SQL Server Scheduled Job tsul_insertintolinkedserver' (0xF1DFC3FC6CA6D311A78B00105A5EAA5F) - Status: Failed - Invoked on: 12/12/99 9:40:52 PM - Message: The job failed. The Job was invoked by User sa. The last step to run was step 1 (tsul_insertintolinkedserver).
    ------------
    Ray Miao at 12/13/99 8:36:23 AM

    Do you have detailed error message?


    ------------
    Tom Bartos at 12/13/99 1:27:49 AM

    I wrote a Stored Procedure I wish to run as a job. It inserts data to a linked server. The stored procedure runs fine from the sql query analyzer but fails as a job. There are no permissions assigned to this stored procedure as I beleive it runs under the context of sa which has default access granted.

    Can someone give me some insite why this stored procedure won't run as a scheduled job?

    ALTER PROCEDURE tsul_insertintolinkedserver
    AS
    DECLARE @srvname varChar(20)
    SELECT @srvname = @@servername
    insert into THOMAS.tsnet.dbo.usagelog
    select id, tsgroup, account, error, failedpin, type, servername, ipbrowser, cid, logintime, expand , msgspresent, msgslistened, @srvname
    from usagelog
    where id >
    ( select max(id) from THOMAS.tsnet.dbo.usagelog
    where hostserver = @srvname
    )

    Thanks in advance-

  6. #6
    Guest

    Problems Running a good stored procedure as a job (reply)

    This seems to be a permissions error

    Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. [SQLSTATE 42000] (Error 18452). The step failed.
    ------------
    Ray Miao at 12/13/99 10:24:21 AM

    Find detailed error message in sql server agent errorlog and/or steps detail page.


    ------------
    k at 12/13/99 9:39:11 AM

    my 2 cents.........
    not sure but did you check the simple stuff.... on the STEPS dialog box, the Database name is correct, and the type is "Transact-SQL"

    -k


    ------------
    Tom Bartos at 12/13/99 9:08:53 AM

    The error message doesn't help alot but here it is.

    SQL Server Scheduled Job tsul_insertintolinkedserver' (0xF1DFC3FC6CA6D311A78B00105A5EAA5F) - Status: Failed - Invoked on: 12/12/99 9:40:52 PM - Message: The job failed. The Job was invoked by User sa. The last step to run was step 1 (tsul_insertintolinkedserver).
    ------------
    Ray Miao at 12/13/99 8:36:23 AM

    Do you have detailed error message?


    ------------
    Tom Bartos at 12/13/99 1:27:49 AM

    I wrote a Stored Procedure I wish to run as a job. It inserts data to a linked server. The stored procedure runs fine from the sql query analyzer but fails as a job. There are no permissions assigned to this stored procedure as I beleive it runs under the context of sa which has default access granted.

    Can someone give me some insite why this stored procedure won't run as a scheduled job?

    ALTER PROCEDURE tsul_insertintolinkedserver
    AS
    DECLARE @srvname varChar(20)
    SELECT @srvname = @@servername
    insert into THOMAS.tsnet.dbo.usagelog
    select id, tsgroup, account, error, failedpin, type, servername, ipbrowser, cid, logintime, expand , msgspresent, msgslistened, @srvname
    from usagelog
    where id >
    ( select max(id) from THOMAS.tsnet.dbo.usagelog
    where hostserver = @srvname
    )

    Thanks in advance-

  7. #7
    Tom Bartos Guest

    Problems Running a good stored procedure as a job (reply)

    This seems to be a permissions error. Which user is responsible for running jobs? I am assuming it is sa.

    Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. [SQLSTATE 42000] (Error 18452). The step failed.
    ------------
    Ray Miao at 12/13/99 10:24:21 AM

    Find detailed error message in sql server agent errorlog and/or steps detail page.


    ------------
    k at 12/13/99 9:39:11 AM

    my 2 cents.........
    not sure but did you check the simple stuff.... on the STEPS dialog box, the Database name is correct, and the type is "Transact-SQL"

    -k


    ------------
    Tom Bartos at 12/13/99 9:08:53 AM

    The error message doesn't help alot but here it is.

    SQL Server Scheduled Job tsul_insertintolinkedserver' (0xF1DFC3FC6CA6D311A78B00105A5EAA5F) - Status: Failed - Invoked on: 12/12/99 9:40:52 PM - Message: The job failed. The Job was invoked by User sa. The last step to run was step 1 (tsul_insertintolinkedserver).
    ------------
    Ray Miao at 12/13/99 8:36:23 AM

    Do you have detailed error message?


    ------------
    Tom Bartos at 12/13/99 1:27:49 AM

    I wrote a Stored Procedure I wish to run as a job. It inserts data to a linked server. The stored procedure runs fine from the sql query analyzer but fails as a job. There are no permissions assigned to this stored procedure as I beleive it runs under the context of sa which has default access granted.

    Can someone give me some insite why this stored procedure won't run as a scheduled job?

    ALTER PROCEDURE tsul_insertintolinkedserver
    AS
    DECLARE @srvname varChar(20)
    SELECT @srvname = @@servername
    insert into THOMAS.tsnet.dbo.usagelog
    select id, tsgroup, account, error, failedpin, type, servername, ipbrowser, cid, logintime, expand , msgspresent, msgslistened, @srvname
    from usagelog
    where id >
    ( select max(id) from THOMAS.tsnet.dbo.usagelog
    where hostserver = @srvname
    )

    Thanks in advance-

  8. #8
    Tom Bartos Guest

    Thanks, Setting Remote Permissions allows inserts


    Thanks, for leading me down the road to knowledge

    ------------
    Tom Bartos at 12/13/99 10:33:28 AM

    This seems to be a permissions error. Which user is responsible for running jobs? I am assuming it is sa.

    Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. [SQLSTATE 42000] (Error 18452). The step failed.
    ------------
    Ray Miao at 12/13/99 10:24:21 AM

    Find detailed error message in sql server agent errorlog and/or steps detail page.


    ------------
    k at 12/13/99 9:39:11 AM

    my 2 cents.........
    not sure but did you check the simple stuff.... on the STEPS dialog box, the Database name is correct, and the type is "Transact-SQL"

    -k


    ------------
    Tom Bartos at 12/13/99 9:08:53 AM

    The error message doesn't help alot but here it is.

    SQL Server Scheduled Job tsul_insertintolinkedserver' (0xF1DFC3FC6CA6D311A78B00105A5EAA5F) - Status: Failed - Invoked on: 12/12/99 9:40:52 PM - Message: The job failed. The Job was invoked by User sa. The last step to run was step 1 (tsul_insertintolinkedserver).
    ------------
    Ray Miao at 12/13/99 8:36:23 AM

    Do you have detailed error message?


    ------------
    Tom Bartos at 12/13/99 1:27:49 AM

    I wrote a Stored Procedure I wish to run as a job. It inserts data to a linked server. The stored procedure runs fine from the sql query analyzer but fails as a job. There are no permissions assigned to this stored procedure as I beleive it runs under the context of sa which has default access granted.

    Can someone give me some insite why this stored procedure won't run as a scheduled job?

    ALTER PROCEDURE tsul_insertintolinkedserver
    AS
    DECLARE @srvname varChar(20)
    SELECT @srvname = @@servername
    insert into THOMAS.tsnet.dbo.usagelog
    select id, tsgroup, account, error, failedpin, type, servername, ipbrowser, cid, logintime, expand , msgspresent, msgslistened, @srvname
    from usagelog
    where id >
    ( select max(id) from THOMAS.tsnet.dbo.usagelog
    where hostserver = @srvname
    )

    Thanks in advance-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •