cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a datafile in SQL

Former Member
0 Kudos

Hi,

I am having total 4 datafiles in my sql database.(Three datafiles and one logfile)

I want to create another two datafiles(as testing purpose)I had checked for this and found that creating a new datafile is complicated. Is that really complicated?

If i want to create a datafile, what would be the extension? (i mean .mdf? or ndf?)

Could you guide me on this?

Thanks & Regards,

Nagendra.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yes i am agree with markus there is nothing is complicated.

You can do it through GUI using management studio.

right click on database name click on property click on add and follow onscreen.

through command line i.e.

USE [master]

GO

ALTER DATABASE [sapsid] ADD FILE ( NAME = '<name of datafile>', FILENAME ='<location>\<datafilename>.ndf' , SIZE = 10240000KB , FILEGROWTH = 1024KB ) TO FILEGROUP [PRIMARY]

GO

REgards,

Nikunj Thaker.

Edited by: Nikunj Thaker on Nov 23, 2009 3:04 PM

Former Member
0 Kudos

Hi Markus and Nikunj,

Got following link, Thanks a lot for your valuable response.

[How to Add Data or Log Files to a Database in SQL |http://technet.microsoft.com/en-us/library/ms189253.aspx]

Thanks & Regards,

Nagendra.

Answers (1)

Answers (1)

markus_doehr2
Active Contributor
0 Kudos

> I want to create another two datafiles(as testing purpose)I had checked for this and found that creating a new datafile is complicated. Is that really complicated?

What is "complicated"?

> If i want to create a datafile, what would be the extension? (i mean .mdf? or ndf?)

MDF = Master data file

NDF = secondary data file

Just follow the SQL Server documentation.

Markus