Print Page | Close Window

Help with SQL error

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=30759
Printed Date: 29 March 2026 at 7:40pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Help with SQL error
Posted By: RadioActiveLamb
Subject: Help with SQL error
Date Posted: 30 May 2013 at 6:42pm
I plan to migrate my web server from 2003 to 2012. The current server is running SQL 2008 R2 web edition and the new one is running SQL 2012 Web edition. This exercise is just for testing, so nothing is down or unavailable.

I successfully backed-up and restored the database to the new SQL server. I created a new sql user called "webwiz_sql" and made it an owner of the new database. I also set the database compatibility level to 2012 (110). I edited the dbo.tblConfiguration table with the SQL management studio so that these fields contain the "test" host name for the forum: forum_path and website_path.

The original installation is running WWF v10.14, and the new one has v10.15 installed. On the first visit, I chose to do an "upgrade" installation and provided all the database server details. It worked perfectly and displayed the forum home page with all the existing messages. However, when I try to log-in to the admin panel or to the forum, I get this error message and not sure where to proceed. Clues?:

Server Error in Forum Application
An error has occurred while writing to the database.
Please contact the Forum Administrator.

Support Error Code:- err_SQLServer_loginUser()_update_USR_Code
File Name:- functions_login.asp
Forum Version:- 10.15

Error details:-
Microsoft OLE DB Provider for SQL Server
Incorrect syntax near '44446'.



Replies:
Posted By: RadioActiveLamb
Date Posted: 30 May 2013 at 6:46pm
I am also getting an error by trying to open forum posts as a guest, since I cannot log-in. Oh well...

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.15

Error details:-
Microsoft OLE DB Provider for SQL Server
Incorrect syntax near '44446'.


Posted By: WebWiz-Bruce
Date Posted: 31 May 2013 at 10:44am
Our own Web Wiz Forums that you are using here was moved from SQL Server 2008 R2 to SQLServer 2012 last summer, so know that it should work. I suspect that the issue maybe in the way that you moved the database.

Before creating a backup of the database place the database in simple recovery mode and shrink both the database and files.

Next create the backup of the database (a .bak file) which you then restore to your new SQL Server 2012 database server.

The old tblConfiguration table is not used in version 10 and can be safely deleted. Configuration Settings are now stored in the table tblSetupOptions.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: RadioActiveLamb
Date Posted: 25 September 2013 at 7:24pm
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




Posted By: RadioActiveLamb
Date Posted: 25 September 2013 at 7:49pm
Problem solved: I deleted all the triggers under each table.

Who knows where they came from. I've been using this forum for about 11 years through various versions.


Posted By: WebWiz-Bruce
Date Posted: 26 September 2013 at 9:03am
There are no triggers used in Web Wiz Forums, so not sure where these have come from, maybe you migrated the database at sometime in the past and the procedure automatically created these triggers.

However they were created you are quite safe deleting all the triggers.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net