question

dona avatar image
dona asked

how to create a .ndf file

how to create a .ndf file from a database contains a .mdf file and a .ldf file. Please show to me. Thanks
create
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tim avatar image
Tim answered
You simply create an additional data file. By default it will give it an NDF extension. (NDF = Another Data File). This can be accomplished in the GUI or using TSQL.
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image
Grant Fritchey answered
You just have supply additional information to get another file added. In T-SQL, it would look something like this: CREATE DATABASE [MyNewDB] ON PRIMARY ( NAME = N'MyNewDB', FILENAME = N'C:\DATA\MyNewDB.mdf' , SIZE = 4MB , FILEGROWTH = 200MB ), (NAME = N'MyNewDB2',FILENAME = N'C:\DATA\MyNewDB2.ndf', SIZE = 4MB, FILEGROWTH = 1MB) LOG ON ( NAME = N'MyNewDB_log', FILENAME = N'C:\DATA\MyNewDB_log.ldf' , SIZE = 1mb , FILEGROWTH = 20MB) GO You can see how I've just added a comma and supplied a second file with a different logical name and a different file name. If you were using the Management Studio GUI you just use the 'Add' button at the bottom of the 'New Database' screen to get a window that lets you define that second file.
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.