En algunos escenarios puede ser muy útil incluir también los datos de dichos objetos de los que generamos el script (tablas maestras por ejemplo). Desgraciadamente dicha opción no estaba presente en las versiones anteriores a Microsoft SQL Server 2008.
CREATE TABLE [dbo].[Roles](
[RoleID] [uniqueidentifier] NOT NULL,
[RoleName] [nvarchar](260) NOT NULL,
[Description] [nvarchar](512) NULL,
[TaskMask] [nvarchar](32) NOT NULL,
[RoleFlags] [tinyint] NOT NULL,
CONSTRAINT [PK_Roles] PRIMARY KEY NONCLUSTERED
(
[RoleID] 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
CREATE UNIQUE CLUSTERED INDEX [IX_Roles] ON [dbo].[Roles]
(
[RoleName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
INSERT [dbo].[Roles] ([RoleID], [RoleName], [Description], [TaskMask], [RoleFlags]) VALUES (N’114e91eb-1868-4cf7-8e9d-f43a19813b7f’, N’Browser’, N’May view folders, reports and subscribe to reports.’, N’0010101001000100′, 0)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [Description], [TaskMask], [RoleFlags]) VALUES (N’9bc89cad-3d9a-491d-be02-75be1579af2c’, N’Content Manager’, N’May manage content in the Report Server. This includes folders, reports and resources.’, N’1111111111111111′, 0)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [Description], [TaskMask], [RoleFlags]) VALUES (N’0286b7fb-a18b-4fa4-bb59-adb7cf28df73′, N’Model Item Browser’, N’Allows users to view model items in a particular model.’, N’1′, 2)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [Description], [TaskMask], [RoleFlags]) VALUES (N’29c8f388-b3f6-4a4d-a7d9-eed72f3c0bd2′, N’My Reports’, N’May publish reports and linked reports; manage folders, reports and resources in a users My Reports folder.’, N’0111111111011000′, 0)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [Description], [TaskMask], [RoleFlags]) VALUES (N’5d9fa665-e315-4249-b519-0e3668f3d49d’, N’Publisher’, N’May publish reports and linked reports to the Report Server.’, N’0101010100001010′, 0)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [Description], [TaskMask], [RoleFlags]) VALUES (N’e51e9553-4f47-4619-a943-05020a373862′, N’Report Builder’, N’May view report definitions.’, N’0010101001000101′, 0)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [Description], [TaskMask], [RoleFlags]) VALUES (N’8ca532d7-7e5c-4f18-8976-d2d4ffd95472′, N’System Administrator’, N’View and modify system role assignments, system role definitions, system properties, and shared schedules.’, N’110101011′, 1)
INSERT [dbo].[Roles] ([RoleID], [RoleName], [Description], [TaskMask], [RoleFlags]) VALUES (N’a5f16ea9-fb16-4898-b8f1-9d05351f56de’, N’System User’, N’View system properties and shared schedules.’, N’001010001′, 1)
Podemos elegir al generar el script la versión de SQL Server (2000, 2005 o 2008) Como pequeño tirón de orejas , indicar que el ejemplo anterior ha sido generado para “SQL Server 2008” y vemos que no se están utilizando los nuevos constructores de fila para generar los insert.