Stored Procedure, error when executing (

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Goog79

    #1

    Stored Procedure, error when executing (

    Hi everyone,

    first time here, so I'm sorry if this has been covered already ages
    ago. :(

    I am trying to learn T-SQL and Stored Procedures and bought the book
    on these topics by Djan Sunderic, Publisher McGraw Hill/Osborne. I'm
    already stuck on my first Stored Procedure and getting error messages
    that I cannot understand. I've already tried Google and Microsoft
    online to no avail. I do have the .NET Framework on my system and use
    it for programming in C# sometimes and by the looks of the error, it's
    something to do with that? Please note I am only using SQL Server
    Express.

    Here is the first Stored Procedure:

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFI ER ON
    GO

    CREATE PROCEDURE ap_Hello
    AS
    BEGIN
    SET NOCOUNT ON;

    SELECT 'Hello world'
    SELECT * from dbo.EqType
    END
    GO

    The error in its entirety is this:

    Msg 6522, Level 16, State 1, Procedure ctrd_DDL_PROCED URE_EVENTS_vb,
    Line 1
    A .NET Framework error occurred during execution of user defined
    routine or aggregate 'ctrd_DDL_PROCE DURE_EVENTS_vb' :
    System.Unauthor izedAccessExcep tion: Access to the path 'c:
    \server_login.l og' is denied.
    System.Unauthor izedAccessExcep tion:
    at System.IO.__Err or.WinIOError(I nt32 errorCode, String
    maybeFullPath)
    at System.IO.FileS tream.Init(Stri ng path, FileMode mode, FileAccess
    access, Int32 rights, Boolean useRights, FileShare share, Int32
    bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs, String
    msgPath, Boolean bFromProxy)
    at System.IO.FileS tream..ctor(Str ing path, FileMode mode,
    FileAccess access, FileShare share, Int32 bufferSize, FileOptions
    options)
    at System.IO.Strea mWriter.CreateF ile(String path, Boolean append)
    at System.IO.Strea mWriter..ctor(S tring path, Boolean append,
    Encoding encoding, Int32 bufferSize)
    at System.IO.Strea mWriter..ctor(S tring path, Boolean append)
    at VbTriggers.Trig gers.trigger_DD L_PROCEDURE_EVE NTS()
    ..
    The statement has been terminated.

    Can anyone assist please? :(

    Many thanks in advance,
    Lara

  • Goog79

    #2
    Re: Stored Procedure, error when executing (

    Further to my last post, there is no c:
    \server_login.l og file. Where is it supposed to be and how would I
    set SQL Server to look there (if this would solve the problem)?

    Thanks again everyone!

    Comment

    • Greg D. Moore \(Strider\)

      #3
      Re: Stored Procedure, error when executing (



      "Goog79" <rachellara1979 @gmail.comwrote in message
      news:1171995280 .013209.191390@ v45g2000cwv.goo glegroups.com.. .
      Hi everyone,
      >
      first time here, so I'm sorry if this has been covered already ages
      ago. :(
      The stored proc itself looks fine.

      But it's the .NET Framework that's giving the error. You may want to look
      to a newsgroup that focuses on NET for more help.

      >
      I am trying to learn T-SQL and Stored Procedures and bought the book
      on these topics by Djan Sunderic, Publisher McGraw Hill/Osborne. I'm
      already stuck on my first Stored Procedure and getting error messages
      that I cannot understand. I've already tried Google and Microsoft
      online to no avail. I do have the .NET Framework on my system and use
      it for programming in C# sometimes and by the looks of the error, it's
      something to do with that? Please note I am only using SQL Server
      Express.
      >
      Here is the first Stored Procedure:
      >
      The error in its entirety is this:
      >
      Msg 6522, Level 16, State 1, Procedure ctrd_DDL_PROCED URE_EVENTS_vb,
      Line 1
      A .NET Framework error occurred during execution of user defined
      routine or aggregate 'ctrd_DDL_PROCE DURE_EVENTS_vb' :
      System.Unauthor izedAccessExcep tion: Access to the path 'c:
      \server_login.l og' is denied.
      System.Unauthor izedAccessExcep tion:
      at System.IO.__Err or.WinIOError(I nt32 errorCode, String
      maybeFullPath)
      at System.IO.FileS tream.Init(Stri ng path, FileMode mode, FileAccess
      access, Int32 rights, Boolean useRights, FileShare share, Int32
      bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs, String
      msgPath, Boolean bFromProxy)
      at System.IO.FileS tream..ctor(Str ing path, FileMode mode,
      FileAccess access, FileShare share, Int32 bufferSize, FileOptions
      options)
      at System.IO.Strea mWriter.CreateF ile(String path, Boolean append)
      at System.IO.Strea mWriter..ctor(S tring path, Boolean append,
      Encoding encoding, Int32 bufferSize)
      at System.IO.Strea mWriter..ctor(S tring path, Boolean append)
      at VbTriggers.Trig gers.trigger_DD L_PROCEDURE_EVE NTS()
      .
      The statement has been terminated.
      >
      Can anyone assist please? :(
      >
      Many thanks in advance,
      Lara
      >--
      Greg Moore
      SQL Server DBA Consulting
      sql (at) greenms.com http://www.greenms.com


      Comment

      • Erland Sommarskog

        #4
        Re: Stored Procedure, error when executing (

        Goog79 (rachellara1979 @gmail.com) writes:
        I am trying to learn T-SQL and Stored Procedures and bought the book
        on these topics by Djan Sunderic, Publisher McGraw Hill/Osborne. I'm
        already stuck on my first Stored Procedure and getting error messages
        that I cannot understand. I've already tried Google and Microsoft
        online to no avail. I do have the .NET Framework on my system and use
        it for programming in C# sometimes and by the looks of the error, it's
        something to do with that? Please note I am only using SQL Server
        Express.
        >
        Here is the first Stored Procedure:
        >
        SET ANSI_NULLS ON
        GO
        SET QUOTED_IDENTIFI ER ON
        GO
        >
        CREATE PROCEDURE ap_Hello
        AS
        BEGIN
        SET NOCOUNT ON;
        >
        SELECT 'Hello world'
        SELECT * from dbo.EqType
        END
        GO
        >
        The error in its entirety is this:
        >
        Msg 6522, Level 16, State 1, Procedure ctrd_DDL_PROCED URE_EVENTS_vb,
        Line 1
        A .NET Framework error occurred during execution of user defined
        routine or aggregate 'ctrd_DDL_PROCE DURE_EVENTS_vb' :
        System.Unauthor izedAccessExcep tion: Access to the path 'c:
        \server_login.l og' is denied.
        Do you get this error when you run the procedure or when you create
        it? My guess is for the latter, because this looks like an error from
        a DDL trigger. If it happens when you run the procedure, I assume that
        there is something interesting in that table or view.

        DDL triggers does not come out of the blue. I would guess that this is
        a database that came with the book. Why they would include a DDL trigger
        that writes to disk, I don't know. But maybe you inherited it from
        someone who already had used it for exercises in the book?

        There is nothing built-in in SQL Server that would write to this file.



        A DDL trigger is a trigger that fires at operations like creating tables,
        procedures etc. DDL = Data Definition Language.

        --
        Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

        Books Online for SQL Server 2005 at
        http://www.microsoft.com/technet/pro...ads/books.mspx
        Books Online for SQL Server 2000 at
        http://www.microsoft.com/sql/prodinf...ons/books.mspx

        Comment

        Working...