if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[kpd_types]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[kpd_types]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[kpd_wordreports]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[kpd_wordreports]
GO
CREATE TABLE [dbo].[kpd_types] (
[oid] [int] IDENTITY (1, 1) NOT NULL ,
[category] [varchar] (32) NULL ,
[label] [varchar] (128) NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[kpd_wordreports] (
[oid] [int] IDENTITY (1, 1) NOT NULL ,
[title] [varchar] (64) NULL ,
[sql] [varchar] (256) NULL ,
[xsd] [text] NULL ,
[wml] [text] NULL ,
[xslt] [text] NULL ,
[xmlns] [varchar] (100) NULL ,
[xmlalias] [varchar] (24) NULL ,
[xmlfilename] [varchar] (256) NULL ,
[isupdate] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
-- Delete all records first
DELETE FROM [dbo].[kpd_types]
GO
SET IDENTITY_INSERT [dbo].[kpd_types] ON
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (1, 'cargo', 'paper')
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (2, 'cargo', 'food')
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (3, 'cargo', 'metal')
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (4, 'cargo', 'wood')
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (5, 'marka', 'MAN')
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (6, 'marka', 'DAF')
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (7, 'marka', 'Mersedes')
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (8, 'marka', 'Volvo')
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (9, 'marka', 'Gazel')
INSERT INTO [dbo].[kpd_types] ([oid], [category], [label])
VALUES (10, 'marka', 'Kamaz')
SET IDENTITY_INSERT [dbo].[kpd_types] OFF
-- Delete all records first
DELETE FROM [dbo].[kpd_wordreports]
GO
SET IDENTITY_INSERT [dbo].[kpd_wordreports] ON
INSERT INTO [dbo].[kpd_wordreports] ([oid], [title], [sql], [xsd], [xmlns], [xmlalias], [xmlfilename], [isupdate], [wml], [xslt])
VALUES (4, 'Sample WRG template', 'with xmlnamespaces(default ''http://kpd_types.xsd'')
select * from kpd_types for xml PATH(''kpd_types''),ROOT(''root'')', '<?xml version="1.0" standalone="yes"?>
<xs:schema id="root" targetNamespace="http://kpd_types.xsd" xmlns:mstns="http://kpd_types.xsd" xmlns="http://kpd_types.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="root" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="kpd_types">
<xs:complexType>
<xs:sequence>
<xs:element name="oid" type="xs:string" minOccurs="0" />
<xs:element name="category" type="xs:string" minOccurs="0" />
<xs:element name="label" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>', 'http://kpd_types.xsd', 'kpd_types', 'kpd_types', NULL, '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:ns0="http://kpd_types.xsd" w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve"><o:DocumentProperties><o:Author>Administrator</o:Author><o:LastAuthor>Administrator</o:LastAuthor><o:Revision>1</o:Revision><o:TotalTime>0</o:TotalTime><o:Created>2008-01-04T18:44:00Z</o:Created><o:LastSaved>2008-01-04T18:44:00Z</o:LastSaved><o:Pages>1</o:Pages><o:Words>1</o:Words><o:Characters>8</o:Characters><o:Company>inp</o:Company><o:Lines>1</o:Lines><o:Paragraphs>1</o:Paragraphs><o:CharactersWithSpaces>8</o:CharactersWithSpaces><o:Version>11.5604</o:Version></o:DocumentProperties><w:fonts><w:defaultFonts w:ascii="Times New Roman" w:fareast="Times New Roman" w:h-ansi="Times New Roman" w:cs="Times New Roman"/></w:fonts><w:styles><w:versionOfBuiltInStylenames w:val="4"/><w:latentStyles w:defLockedState="off" w:latentStyleCount="156"/><w:style w:type="paragraph" w:default="on" w:styleId="a"><w:name w:val="Normal"/><wx:uiName wx:val="???????"/><w:rPr><wx:font wx:val="Times New Roman"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:lang w:val="EN-US" w:fareast="EN-US" w:bidi="AR-SA"/></w:rPr></w:style><w:style w:type="character" w:default="on" w:styleId="a0"><w:name w:val="Default Paragraph Font"/><wx:uiName wx:val="???????? ????? ??????"/><w:semiHidden/></w:style><w:style w:type="table" w:default="on" w:styleId="a1"><w:name w:val="Normal Table"/><wx:uiName wx:val="??????? ???????"/><w:semiHidden/><w:rPr><wx:font wx:val="Times New Roman"/></w:rPr><w:tblPr><w:tblInd w:w="0" w:type="dxa"/><w:tblCellMar><w:top w:w="0" w:type="dxa"/><w:left w:w="108" w:type="dxa"/><w:bottom w:w="0" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style><w:style w:type="list" w:default="on" w:styleId="a2"><w:name w:val="No List"/><wx:uiName wx:val="??? ??????"/><w:semiHidden/></w:style><w:style w:type="paragraph" w:styleId="a3"><w:name w:val="Plain Text"/><wx:uiName wx:val="?????"/><w:basedOn w:val="a"/><w:rsid w:val="0061388C"/><w:pPr><w:pStyle w:val="a3"/></w:pPr><w:rPr><w:rFonts w:ascii="Courier New" w:h-ansi="Courier New" w:cs="Courier New"/><wx:font wx:val="Courier New"/><w:sz w:val="20"/><w:sz-cs w:val="20"/></w:rPr></w:style></w:styles><w:docPr><w:view w:val="print"/><w:zoom w:percent="100"/><w:dontDisplayPageBoundaries/><w:doNotEmbedSystemFonts/><w:proofState w:grammar="clean"/><w:attachedTemplate w:val=""/><w:defaultTabStop w:val="720"/><w:punctuationKerning/><w:characterSpacingControl w:val="DontCompress"/><w:optimizeForBrowser/><w:validateAgainstSchema/><w:saveInvalidXML/><w:ignoreMixedContent w:val="off"/><w:alwaysShowPlaceholderText w:val="off"/><w:compat><w:breakWrappedTables/><w:snapToGridInCell/><w:wrapTextWithPunct/><w:useAsianBreakRules/><w:dontGrowAutofit/></w:compat></w:docPr><w:body><wx:sect><ns0:root><ns0:kpd_types><ns0:category><w:p><w:pPr><w:pStyle w:val="a3"/></w:pPr></w:p></ns0:category></ns0:kpd_types><w:p><w:pPr><w:pStyle w:val="a3"/></w:pPr></w:p></ns0:root><w:sectPr><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1134" w:right="1319" w:bottom="1134" w:left="1319" w:header="720" w:footer="720" w:gutter="0"/><w:cols w:space="720"/><w:docGrid w:line-pitch="360"/></w:sectPr></wx:sect></w:body></w:wordDocument>', '')
SET IDENTITY_INSERT [dbo].[kpd_wordreports] OFF