Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Help with trigger please...

Help with trigger please...

Scheduled Pinned Locked Moved Database
databasehelpquestionwpfannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Support123
    wrote on last edited by
    #1

    i have written a trigger as followed: -- ================================================ -- Template generated from Template Explorer using: -- Create Trigger (New Menu).SQL -- -- Use the Specify Values for Template Parameters -- command (Ctrl-Shift-M) to fill in the parameter -- values below. -- -- See additional Create Trigger templates for more -- examples of different Trigger statements. -- -- This block of comments will not be included in -- the definition of the function. -- ================================================ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= CREATE TRIGGER tr_stagingEmployer_Update ON Employer AFTER UPDATE AS -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; INSERT INTO stagingEmployer SELECT *, 'U' as [Action] FROM Inserted GO BUT i get error stating: Msg 311, Level 16, State 1, Procedure tr_stagingEmployer_Update, Line 14 Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables. what is wrong with this query?

    "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

    P 1 Reply Last reply
    0
    • S Support123

      i have written a trigger as followed: -- ================================================ -- Template generated from Template Explorer using: -- Create Trigger (New Menu).SQL -- -- Use the Specify Values for Template Parameters -- command (Ctrl-Shift-M) to fill in the parameter -- values below. -- -- See additional Create Trigger templates for more -- examples of different Trigger statements. -- -- This block of comments will not be included in -- the definition of the function. -- ================================================ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= CREATE TRIGGER tr_stagingEmployer_Update ON Employer AFTER UPDATE AS -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; INSERT INTO stagingEmployer SELECT *, 'U' as [Action] FROM Inserted GO BUT i get error stating: Msg 311, Level 16, State 1, Procedure tr_stagingEmployer_Update, Line 14 Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables. what is wrong with this query?

      "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      From a Microsoft article on the subject: SQL Server 2005 does not allow for text, ntext, or image column references in the inserted and deleted tables for AFTER triggers. However, these data types are included for backward compatibility purposes only. The preferred storage for large data is to use the varchar(max), nvarchar(max), and varbinary(max) data types. Both AFTER and INSTEAD OF triggers support varchar(max), nvarchar(max), and varbinary(max) data in the inserted and deleted tables

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      S 1 Reply Last reply
      0
      • P pmarfleet

        From a Microsoft article on the subject: SQL Server 2005 does not allow for text, ntext, or image column references in the inserted and deleted tables for AFTER triggers. However, these data types are included for backward compatibility purposes only. The preferred storage for large data is to use the varchar(max), nvarchar(max), and varbinary(max) data types. Both AFTER and INSTEAD OF triggers support varchar(max), nvarchar(max), and varbinary(max) data in the inserted and deleted tables

        Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

        S Offline
        S Offline
        Support123
        wrote on last edited by
        #3

        Okay, so am i wrong when i say that the query is fine the way it is... it is due to the fact that one of the columns is of image type in my table? If it wasn't for that the query would have worked???

        "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

        P 1 Reply Last reply
        0
        • S Support123

          Okay, so am i wrong when i say that the query is fine the way it is... it is due to the fact that one of the columns is of image type in my table? If it wasn't for that the query would have worked???

          "Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison

          P Offline
          P Offline
          pmarfleet
          wrote on last edited by
          #4

          This article[^] provides more information on the subject.

          Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups