i am using ssms 2016 vs a 2008 database. i get a scripting error message when attempting to modify or script an SP
when I use ssms 2014 it works with no problems. i have tried dropping and recreating the sp using 2016 and it still does not work
the message:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Script failed for StoredProcedure 'dbo.rashim_adv_search'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=13.0.15800.18+((SSMS_Rel).160914-0312)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Script+StoredProcedure&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
Syntax error in TextHeader of StoredProcedure 'rashim_adv_search'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=13.0.15800.18+((SSMS_Rel).160914-0312)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
the SP as scripted via 2014
USE [broadcasts]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: David Berlinger
-- Create date: 13 Sep 2011
-- Description: rashim_adv_search
-- =============================================
create PROCEDURE [dbo].[rashim_adv_search]
(@channel_xml xml, @from date,@to date,@bi_xml xml,@edit_user int,
@creation_name nvarchar(50),@perf_xml xml,@lyrist_xml xml,@composer_xml xml,
@company nvarchar(50),@creation_type tinyint
)
AS
BEGIN
declare @idoc int
declare @chan table (channel_code tinyint)
declare @bi table (broadcast_item int)
declare @perf table (artist int)
declare @lyrist table (artist int)
declare @composer table (artist int)
declare @edit_worker int
if @edit_user is not null set @edit_worker=tashtit.dbo.get_worker_id_via_userid(2,@edit_user)
set @creation_name= '%'+isnull(@creation_name,'')+'%'
EXEC sp_xml_preparedocument @idoc OUTPUT, @channel_xml
insert into @chan (channel_code )
SELECT ch
FROM OPENXML (@idoc, '/root/r',1)
WITH ( ch tinyint)
exec sp_xml_removedocument @idoc
if @bi_xml is not null
begin
EXEC sp_xml_preparedocument @idoc OUTPUT, @bi_xml
insert into @bi (broadcast_item )
SELECT item
FROM OPENXML (@idoc, '/root/r',1)
WITH ( item int)
exec sp_xml_removedocument @idoc
end
if @perf_xml is not null
begin
EXEC sp_xml_preparedocument @idoc OUTPUT, @perf_xml
insert into @perf (artist )
SELECT artist
FROM OPENXML (@idoc, '/root/r',1)
WITH ( artist int)
exec sp_xml_removedocument @idoc
end
if @lyrist_xml is not null
begin
EXEC sp_xml_preparedocument @idoc OUTPUT, @lyrist_xml
insert into @lyrist (artist )
SELECT artist
FROM OPENXML (@idoc, '/root/r',1)
WITH ( artist int)
exec sp_xml_removedocument @idoc
end
if @composer_xml is not null
begin
EXEC sp_xml_preparedocument @idoc OUTPUT, @composer_xml
insert into @composer (artist )
SELECT artist
FROM OPENXML (@idoc, '/root/r',1)
WITH ( artist int)
exec sp_xml_removedocument @idoc
end
SELECT distinct top 1001 'rash_adv' as rash_adv,
dbo.schedules.schedule_code, dbo.schedules.schedule_date, dbo.schedules.start_date,
dbo.schedules.title, dbo.rashim_titles.edit_worker,
dbo.rashim_details.performance_code,
creation_details_view.creation_name,
creation_details_view.creation_name_heb, creation_details_view.creators,
creation_details_view.main_performer, creation_details_view.recording_name,
creation_details_view.main_performer_codes, dbo.rashim_details.item_num,
recording_media_view.company,
tashtit.dbo.get_users_name_via_workerid(dbo.rashim_titles.edit_worker) as edit_workername,
tashtit.dbo.get_users_name_via_workerid(dbo.rashim_titles.edit_worker) as edit_username
FROM dbo.schedules INNER JOIN
dbo.rashim_titles ON dbo.schedules.schedule_code = dbo.rashim_titles.schedule_code INNER JOIN
dbo.rashim_details ON dbo.rashim_titles.rashim_code = dbo.rashim_details.rashim_code INNER JOIN
dbo.creation_details_view ON
dbo.rashim_details.performance_code = creation_details_view.performance_code LEFT OUTER JOIN
dbo.recording_medias recording_media_view
ON dbo.rashim_details.item_num = recording_media_view.device_num
where schedules.channel_code in (select channel_code from @chan )
and schedules.schedule_date between @from and @to
and (@bi_xml is null or schedules.broadcast_item_code in (select broadcast_item from @bi))
and (@edit_worker is null or dbo.rashim_titles.edit_worker=@edit_worker)
and (dbo.creation_details_view.creation_type_code=@creation_type or @creation_type is null)
and (creation_details_view.creation_name like @creation_name or
creation_details_view.creation_name_heb like @creation_name or
@creation_name ='%%')
and (@company is null or recording_media_view.company = @company)
and (@perf_xml is null or creation_details_view.version_code in
(select version_code from dbo.version_artist_view
where artist_code in (select artist from @perf)))
and (@lyrist_xml is null or creation_details_view.creation_code in
(select creation_code from dbo.creation_artist_view
where job_code in (1,11)
and artist_code in (select artist from @lyrist)))
and (@composer_xml is null or creation_details_view.creation_code in
(select creation_code from dbo.creation_artist_view
where job_code in (2,11)
and artist_code in (select artist from @composer)))
option(recompile)
END
???