0

I've installed SQL Server 2012 Express. I'm doing some test with this and Server 2008 Express.

With 2008, all is ok. But with the 2012, I get some troubles.

I'm using it from my c# app, with code like this:

t = server.ConnectionContext.ExecuteNonQuery("SELECT * FROM sys.server_principals");

The query in the row above is only a test I've done, after the script I need get error.

But, also this get the same error: MODIFY FILE failed. Specified size is less than or equal to current size. But why? I saw around that this error comes when something is done about the log... or not?

Why I get this error? The login data are correctly. This a new installation, so I am logged in as sa (the script will then create a new user).

The same script works perfectly with SQL Server 2008 Express. I don't get why with 2012 is in this way.. what am I missing? Further, I install both 2008 and 2012 from command line with the same parameter:

/q /hideconsole /action=Install /features=SQL /instancename=SQLEXPRESS 
/securitymode=SQL /sapwd=xxx /enableranu=1 /sqlsvcaccount="NT Authority\Network Service" 
/AddCurrentUserAsSqlAdmin /IAcceptSqlServerLicenseTerms  
/skiprules=RebootRequiredCheck

Anyway, the script I want to run is (but, as I said, also the simply SQL above causes the error):

IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = ****')
    CREATE LOGIN [icaddb] 
       WITH PASSWORD = '****', DEFAULT_DATABASE = [master],   
       DEFAULT_LANGUAGE = [us_english], CHECK_EXPIRATION = OFF, CHECK_POLICY = ON
GO

EXEC sys.sp_addsrvrolemember @loginame = ****', @rolename = N'sysadmin'
GO

EDIT:

enter image description here

3
  • Have you tried running that same command from SQL Server Management Studio (or similar)? That would indicate whether the issue is related to your program or not. Commented Feb 16, 2015 at 8:57
  • Do you have any ALTER / CREATE DATABASE in your scripts? Commented Feb 16, 2015 at 11:54
  • yes, create database Commented Feb 16, 2015 at 11:58

1 Answer 1

0

The problem was this:

CREATE DATABASE [IN4MATICSystemSCRIPT_TEST2] 
GO
ALTER DATABASE IN4MATICSystemSCRIPT_TEST2 MODIFY FILE 
( NAME = N'IN4MATICSystemSCRIPT_TEST2' , SIZE = 8384KB , MAXSIZE =     UNLIMITED, FILEGROWTH = 1024KB )
GO
ALTER DATABASE IN4MATICSystemSCRIPT_TEST2 MODIFY FILE 
( NAME = N'IN4MATICSystemSCRIPT_TEST2_log' , SIZE = 24384KB , MAXSIZE =     2048GB , FILEGROWTH = 10%)
GO

Solved removing these rows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.