|
I am giving this procedure another stab. My goal is to move to Server 2012 on a different VM hosting provider. I'll save roughly 50% of my current costs and be able to use the URL rewriting feature.
I've tried running the shrink/backup with the same result:
Server Error in Forum Application An error has occurred while writing to the database. Please contact the Forum Administrator.
Support Error Code:- err_SQLServer_update_no._views File Name:- forum_posts.asp Forum Version:- 10.16
Error details:- Microsoft OLE DB Provider for SQL Server Incorrect syntax near '44446'.
If I take that SQL backup and restore it on the existing Server 2003 & SQL 2008 R2, it works fine. The error above occurs on Server 2012 and SQL 2012 when I navigate down to a forum post, and I think I may have found the problem.
There are several triggers for various tables. Each one has a "RAISERROR" statement. This statement has apparently been depreciated in SQL since version 6. In versions prior to 2012, it still worked without parenthesis. In SQL 2012, it absolutely requires parenthesis. http://msdn.microsoft.com/en-us/library/ms178592.aspx" rel="nofollow - http://msdn.microsoft.com/en-us/library/ms178592.aspx
Microsoft recommends using "THROW" instead of RAISERROR
I'm curious if these Triggers that I have are relics of a very old version of the forum software, are automatically generated, or are written by some other means. Not every table has triggers. I'd like to try updating the code. Can you help me identify where it originated?
Here's the code for just one of the triggers:
USE [mhvillages]GO /****** Object: Trigger [dbo].[T_tblForum_UTrig] Script Date: 9/25/2013 7:26:02 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [dbo].[T_tblForum_UTrig] ON [dbo].[tblForum] FOR UPDATE AS SET NOCOUNT ON /* * PREVENT UPDATES IF NO MATCHING KEY IN 'tblCategory' */ IF UPDATE(Cat_ID) BEGIN IF (SELECT COUNT(*) FROM inserted) != (SELECT COUNT(*) FROM tblCategory, inserted WHERE (tblCategory.Cat_ID = inserted.Cat_ID)) BEGIN RAISERROR 44446 'The record can''t be added or changed. Referential integrity rules require a related record in table ''tblCategory''.' ROLLBACK TRANSACTION END END
/* * PREVENT UPDATES IF DEPENDENT RECORDS IN 'tblPermissions' */ IF UPDATE(Forum_ID) BEGIN IF (SELECT COUNT(*) FROM deleted, tblPermissions WHERE (deleted.Forum_ID = tblPermissions.Forum_ID)) > 0 BEGIN RAISERROR 44446 'The record can''t be deleted or changed. Since related records exist in table ''tblPermissions'', referential integrity rules would be violated.' ROLLBACK TRANSACTION END END
/* * PREVENT UPDATES IF DEPENDENT RECORDS IN 'tblTopic' */ IF UPDATE(Forum_ID) BEGIN IF (SELECT COUNT(*) FROM deleted, tblTopic WHERE (deleted.Forum_ID = tblTopic.Forum_ID)) > 0 BEGIN RAISERROR 44446 'The record can''t be deleted or changed. Since related records exist in table ''tblTopic'', referential integrity rules would be violated.' ROLLBACK TRANSACTION END END |
|