Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Help with SQL error
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Help with SQL error

 Post Reply Post Reply
Author
RadioActiveLamb View Drop Down
Groupie
Groupie


Joined: 29 December 2005
Location: United States
Status: Offline
Points: 171
Post Options Post Options   Thanks (0) Thanks(0)   Quote RadioActiveLamb Quote  Post ReplyReply Direct Link To This Post Topic: Help with SQL error
    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'.
Back to Top
RadioActiveLamb View Drop Down
Groupie
Groupie


Joined: 29 December 2005
Location: United States
Status: Offline
Points: 171
Post Options Post Options   Thanks (0) Thanks(0)   Quote RadioActiveLamb Quote  Post ReplyReply Direct Link To This Post 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'.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
RadioActiveLamb View Drop Down
Groupie
Groupie


Joined: 29 December 2005
Location: United States
Status: Offline
Points: 171
Post Options Post Options   Thanks (0) Thanks(0)   Quote RadioActiveLamb Quote  Post ReplyReply Direct Link To This Post 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

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


Back to Top
RadioActiveLamb View Drop Down
Groupie
Groupie


Joined: 29 December 2005
Location: United States
Status: Offline
Points: 171
Post Options Post Options   Thanks (0) Thanks(0)   Quote RadioActiveLamb Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.