Showing posts with label without. Show all posts
Showing posts with label without. Show all posts

Wednesday, October 15, 2014

Cannot specify a log file in a CREATE DATABASE statement without also specifying at least one data file.

Error Message:Msg 188, Level 15, State 1, Line 2Cannot specify a log file in a CREATE DATABASE statement without also specifying at least one data file.


Try this Solution:

Error of the Severity level 15 are generated by the user and can be resolved by the users. Just remove either the log file(.ldf) specification from Create database Script or specify at least one data file(.mdf).

Wednesday, September 24, 2014

Script to delete millions of records without increasing your log size in SQL Server

DECLARE @continue INT
DECLARE @rowcount INT

SET @continue = 1

WHILE @continue = 1
BEGIN
 PRINT GETDATE()

 SET ROWCOUNT 10000     --Replace 10000 as required


 BEGIN TRANSACTION

 DELETE
 FROM dbo.Transactions
 WHERE TranDate IS NULL --Replace your delete script here

 SET @rowcount = @@rowcount

 COMMIT

 PRINT GETDATE()

 IF @rowcount = 0
 BEGIN
  SET @continue = 0
 END
END