Я хочу разбить список, например
c('SET ANSI_NULLS ON',
'GO',
'SET QUOTED_IDENTIFIER ON',
'GO',
'CREATE TABLE dbo.Person(',
' Person int NOT NULL,',
' acct varchar(1) NOT NULL,',
' Kpl varchar(10) NULL,',
' Fac varchar(10) NULL,',
' Inst varchar(10) NULL,',
' CONSTRAINT PK_Person PRIMARY KEY CLUSTERED ',
'(',
' Person 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',
'ALTER TABLE dbo.Person ADD DEFAULT (getdate()) FOR _Timestamp',
'GO',
'ALTER TABLE dbo.Person ADD DEFAULT (host_name()) FOR _Hostname',
'GO',
'ALTER TABLE dbo.Person ADD DEFAULT (original_login()) FOR _Username',
'GO'
)
, на список-списков, начиная новый список всякий раз, когда будет найдено значение GO
:
c(c('SET ANSI_NULLS ON'),
c('SET QUOTED_IDENTIFIER ON'),
c('CREATE TABLE dbo.Person(',
' Person int NOT NULL,',
' acct varchar(1) NOT NULL,',
' Kpl varchar(10) NULL,',
' Fac varchar(10) NULL,',
' Inst varchar(10) NULL,',
' CONSTRAINT PK_Person PRIMARY KEY CLUSTERED ',
'(',
' Person ASC',
')WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON PRIMARY',
') ON PRIMARY'
),
c('ALTER TABLE dbo.Person ADD DEFAULT (getdate()) FOR _Timestamp'),
c('ALTER TABLE dbo.Person ADD DEFAULT (host_name()) FOR _Hostname'),
c('ALTER TABLE dbo.Person ADD DEFAULT (original_login()) FOR _Username')
)