Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

MSSql various errors


Go to End


2 Posts   1105 Views

Avatar
LarsF

Community Member, 1 Post

31 July 2014 at 1:40pm

Edited: 31/07/2014 1:41pm

Hi,

We've just started to use SilverStripe within our organisation and ran into a few errors that we believe are linked to the way SilverStripe is making use of our MSSql db, whether that's our configuraion fault or something else is the question we'd like to get an answer to.

The latest error is one that comes up when trying to create a new 'banner' via the CMS Gui.

PHP Fatal error: Couldn't run query: SELECT IFNULL(MAX(SortOrder), 0)+1 FROM `Banner` WHERE ClassName = 'Banner'
Last error: 42000, 195, [Microsoft][SQL Server Native Client 11.0][SQL Server]'IFNULL' is not a recognized built-in function name. in ...\framework\model\Database.php on
=> MSSql doesn't have a 'IFNULL" function, but a 'ISNULL'. Why is this being used? Is there something wrong in our setup or a known bug withing the MSSQL module?

Another one that we currently have a work around for is:
PHP Fatal error: Couldn't run query: INSERT INTO "Page" ("ID") VALUES (134);
Last error: 23000, 544, [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot insert explicit value for identity column in table 'Page' when IDENTITY_INSERT is set to OFF. in .....\framework\model\Database.php
=> I understand why it is not working but not why this is happening.

We use the latest version of SilverStripe and the MSSql module (as can be downloaded now).

Any help would be appreciated.

Regards,
Lars

Avatar
martimiz

Forum Moderator, 1391 Posts

3 August 2014 at 3:18am

Do you have any idea where that query is coming from? Because 'banner' is not a core SilVerstripe object, i suppose there is some custom code involved or maybe a third party module? It could be that that code is not using the database abstraction layer correctly but, for example, straight MySql queries instead?