1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[_myProcSort]
@DST_CODE nvarchar(1000)
AS
BEGIN
SET NOCOUNT ON;
if (@DST_CODE is not null)
BEGIN
declare @DstCodeXmlList nvarchar(3);
exec sp_xml_preparedocument @DstCodeXmlList output, @DST_CODE
select
dst.dst_name
from
DISTRIBUTORS dst (nolock)
where
dst.dst_code in OPENXML (@DstCodeXmlList, '/ROOT/Dst', 1) WITH (DstCode nvarchar(3))
exec sp_xml_removedocument @DstCodeXmlList
END
else
BEGIN
select
dst.dst_name
from
DISTRIBUTORS dst (nolock);
END
END |
Partager