this is a partial view of my script to generate the drop index for a particular index
,[DropIndexScript] = 'DROP INDEX ' + QUOTENAME(SI.name) +
+ CHAR(13) + ' ON ' +
QUOTENAME(Schema_name(T.Schema_id)) +'.'+ QUOTENAME(T.name) + CHAR(10) + CHAR(13) + 'GO' + CHAR(13)
FROM sys.indexes I
INNER JOIN (
SELECT Object_id
,Schema_id
,NAME
FROM sys.tables
UNION ALL
SELECT Object_id
,Schema_id
,NAME
FROM sys.views
) T
ON T.Object_id = I.Object_id
INNER JOIN sys.sysindexes SI ON I.Object_id = SI.id AND I.index_id = SI.indid
the question is:
when I use this:
+ CHAR(10) + CHAR(13) + 'GO' + CHAR(13)
It works - generates this script:
DROP INDEX [IDX_ProdImages_GetProductListingPageDenormalisedData]
ON [dbo].[ProductImages]
GO
when I don't use the + CHAR(10) + CHAR(13) +
Msg 102, Level 15, State 1, Line 38289 Incorrect syntax near 'GO'.
is there any other way to get this done?

GObetween DROP statements anyway.