0 votes
1 view
in SQL by (20.3k points)

I'm creating an SQL setup script and I'm using someone else's script as an example. Here's an example of the script:

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[be_Categories](

    [CategoryID] [uniqueidentifier] ROWGUIDCOL  NOT NULL CONSTRAINT [DF_be_Categories_CategoryID]  DEFAULT (newid()),

    [CategoryName] [nvarchar](50) NULL,

    [Description] [nvarchar](200) NULL,

    [ParentID] [uniqueidentifier] NULL,

 CONSTRAINT [PK_be_Categories] PRIMARY KEY CLUSTERED 

(

    [CategoryID] ASC

)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

Does anyone know what the ON [PRIMARY] command does?

1 Answer

0 votes
by (40.4k points)

If you are creating a  database in MSQL( Microsoft SQL ) Server, then you can have different file groups, where storage will be created in different places, like disks or directories and so on. You can name each of the file-groups as well.

 As the PRIMARY file-group is default one, it'll be created always, and therefore the SQL that you have given will create your table ON the PRIMARY file-group. 

For full syntax, you can refer to MSDN .

 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...