DonatShell
Server IP : 180.180.241.3  /  Your IP : 216.73.216.252
Web Server : Microsoft-IIS/7.5
System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586
User : IUSR ( 0)
PHP Version : 5.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Program Files (x86)/Microsoft SQL Server/110/DTS/Tasks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/Program Files (x86)/Microsoft SQL Server/110/DTS/Tasks/Microsoft.SqlServer.DmQueryTask.dll
MZ@	!L!This program cannot be run in DOS mode.

$PEL5O! H @Kk@lOX<   H.text  `.rsrc@@.reloc @BH<@P	e:P Gnبvn"vR{s1>YbS؎S9ɛkUNa9Xmj|3ɠHdY0ǕVpߘK3Q QhԔ{r%EZCrp*0})}/{-(T()(*o
,w(f(S(6-W()o
,E(*(g(S{-(T
o
(|(R}/**{80
}/(7o
-
(l(R
(Ko
02(Go
-
(m(R
(?(P(
,
(=(P(
,
(n(R
o
(y(R
}/*	8	2{);*0o
~;(
9~?((>~@((@~A((B~B((D~C((
(
-+(F~D((Hs

s
o
o 
8o!
to"
@o
~H(
,Es\
	~F(o`	~G(o^	~I(ob	o#
8o
~E(
,5sW~F(oY~G(o[o$
+^o%
~<(
,o&
(8+>o%
~=(
,o&
(:+o%
~>(
,o&
(<o'
:u>,o(
(J(L+(ro)
&*A(0~;o*

o+
&~<(7(!~=(9(!~>(;(!~?(=( ~@(?( ~A(A( ~B(C( ~C(E(
( ~D(G( (Io,
+@(-
~Eo*
~FoX( ~GoZ( o+
&(.
-o(
(Ko/
+[(0

~Ho*
~F	o_( ~G	o]( ~I	oa(1
( o+
&(2
-o(
*M4h0o3
o4

,o5
*~6
*0+~6
&o3
o4

,o5
(7
&**$80o8

o9
o3
o:
&*0<r/po8

rCpo9
o*
o;
o3
o:
&o+
&*0O	%(<
{,,{.(T
,(=
E
	{-	{.	
(>
&* "
6{.(T*6{,*05

%(<
|,-+(?
&-(#
,(=
*(*
}*(ho@
&(io@
&*6{+*R|+-+(?
&*+${-(T{.oA
&{-(T{.oB
,*0G{+,8{*oC
,*{-(T{*oD
oE
{-(T()*0(F
oG

rGp(H
*06
r[p9oI
oJ
oK

oL
&*/10K
o
o(+rip(M

oN
	oO
oP
&,o(
*,>0p(Q
(R
,*;(Q
(R
,*9(Q
(R
,*M(Q
(R
,*N(Q
(R
,*O(Q
(R
,*P(Q
(R
,	*(Q
(R
,
*Q(Q
(R
,*R(Q
(R
,
*@(Q
(R
,*S(Q
(R
,*T(Q
(R
,*U(Q
(R
,*V(Q
(R
,*W(Q
(R
,*X(Q
(R
,*oS
(~sT
z0|s
sooJ
oU
8o!
t[s
	orpoV
t9osou,#	rp(W
(X
(M
so+	rpsoXo	oY
&o'
:nu>,o(
s)o/oN
,+oJ
oK

oJ
oU
8o!
t[oZ
u,rp(W
(X
(M
o[
XrpoV
tP(Q
(R
-(Q
(R
,9(Q
(.o\
+(.o\
rpoV
@o]
N(Q
(R
9rpoV
uR-	u@,(^
	+		,	o_
+	o_
rpoV
uR-	u@,(^
	+		,	o`
+	o`
oa
=9(Q
(R
-(Q
(R
, o]
+T(Q
(R
, o]
+3P(Q
(R
, (b
Poc
o
o]
od
oe
&o'
:u>,o(
of
o4og
oh
oi

,-oj


,

ok
&8()+D
uP,	oc
od
ol
t^,+~m
on
X
i2oo
&,oJ

op
&,\X '3&,oq
or
of
oh
oj


,

ok
&o
-
:.,oq
or
,o(
*AL##o*u*0g(0
ssooJ
oU
8o!
t[orpoV
t9os
rpoV
t,9P(Q
(R
-(Q
(R
,9(Q
s+	srpoV
@N(Q
(R
,jrpoV
uR-	u@,(^
,	orpoV
uR-	u@,(^
,	o1o89(Q
(R
, o+x(Q
(R
, o+W,TP(Q
(R
,"(b
Poc
o
o+(Q
(R
, o	oo	oY
&o'
:u>

,
o(
s)		o+oN


	o4oO

oP
&
,
o(
*A4,AZ0rpos

oJ
oK
-(xsT
zoJ
ot
rEpoV
oc
oJ
ot
rqpoV
oc
(u
ov

s~(i +	~(ow
Xi2uh-+o&*0o
o(+sx
 oy
 'oz
o{
o|
o}
oJ
oU
+9o!
t[rpoV
t9
	oo~
	o
&o'
-u>,o(
4s
o
o
&4s
o
,o(
*4\Fm!V{/o
,o
*0s

oJ
oU
+bo!
t[
o
	rpoV
oc
	rpoV
to
	rpoV
u@,@1@o
o'
-u>,o(
*o0	

})(?o
1-(s(Q(?(P
	(
,
	(O
()o
,ݎ(?o
1,(t(Q(N9()o
,Ko
(Ko
>e(u(Q(Ko/
8)(0
	
	o]
o
&

,	
o
-	o]((R8	oa:-%oj
,o
ok
&,b+5o
	o_(
,
@o
o
+Xo
2o
3T	o_((R+@	o_((Q+,	oa3"-
(5
@o
o

o
(2
:o(
(Go
>9(2
(G(,,0(E,%(G((Q(G(-&

,"(G((Q(G(1()o
,&(G((Qu,8-4,(G(/t(G(3+{(G(/+b,^-Noj
,Bo
ok
&+*()oJ
op
&oj
,	ok
&o
--o
-})Fo
(|(R*,	(
,	o


(M,o
**A|<d"8*{0*"}0*{1*"}1*{2*"}2*{3*"}3*{4*"}4*{5*"}5*{6*"}6*{7*"}7*{8*"}8*{9*b{9o
{9o
*{:*b{:o
{:o
*6,	o(
*0GQ
(=(P(
9o
uh-o
(}(R8s
QPo
o
o
s

	(7o
	Po
	o
(Io,
	+b	(-
oZo
o
@o
oXo
o
&o
&oZ(sT
z	(.
-	o(
Po
	o

$o
(|(RP,
Po
Q*ALF8o!$80;
o
u
-o
(}(Ro
({(R*#%80D
o
1",o

(
,#(z(R+-(p+(n(R*0{/,
{/o
*j{/,{/o
&*0$, 
rp(
(
o
*0",	o

+o

-(jsT
z*0	9
rprprprpr[prpr+prpr	p(rsp;rp<rp=rp>rp?r/p@rQpArwpBrpCrpDrpErpFrpGr=pHrkpI*0s
}-s
}.~6
}0~6
}1~6
}2~6
}3~6
}4~6
}5~6
}6~6
}8s
}9s
}:(
*(
*{J*"}J*{K*"}K*(
*{L*"}L*{M*"}M*{N*"}N*(
*(*(*.rp(*.rp(*.rp(*.rp(*.rp(*.rp(*.r7p(*.r]p(*.rp(*.rp(*.rp(*.r	p(*.rK	p(*.rq	p(*.r	p(*.r	p(*.r	p(*.r
p(*.r!
p(*2r]
p(*2r
p(*2r
p(*2r	p(*2rAp(*2rup(*2rp(*2rp(*2rp(*2rp(*2rp(*2rEp(*(
*~r*r*F~q~ro
*0'(
~q~ro

(
*(Q
o
(Q
o
o
s
qr*(
*(
*(
*(
*0T~6
}~6
}~6
}~6
}~6
}~6
}~6
}(
*{*{*{*{*{*{*{*Z{,{*{*Z{,{*{*{(
,{r_p{(
*{*{(
,{rp{(
*{*{*{*{*{*(},(}{*0G(}}{{(
,(}{*0p{-*s

s
s
o
o

,o(
o
o
s

	s
s
{o
oc
*,
0
{i/	{**0
{i/	{*j*0?{(
-0
+{o
~6
oG
X
{o
2*0@~6
}~6
}}s
}s
}((*0s
}{rpo
{rpo
{r'
po
{rU
po
{r
po
{r
po
{r
po
{rpo
{rKpo
{ryp	o
{rp
o
{rpo
{rpo
{rCp
o
{rpo
{rpo
{rpo
{rpo
{r'po
{rQpo
{r}po
{rpo
{rpo
{rpo
{rApo
{rgpo
{rpo
{rpo
;}*0s
}{rpo
{r+po
{rmpo
{rpo
{rpo
{rpo
{rgpo
S}
+{jX
2*6rp(
*0$
8
	u,?	to
rpo
-o
(
s

o
+!	u ,s

	t o
+ݒ		(,n.1d((	(s
	u,	to
o
+"	t jo
	t (


o
3&Xi?*80s

o
(*0`QQQTo
s

rprpo
o
s
rpr
po
o
rWpo
o 
8o!
t
	o3
o
>	o3
o
	8	o!
to%
r{po
,o&
rpo
,+^3+o%
rpo
,o&
rpo
,+;3+o%
rpo
,o&
rpo
,+	o'
:]	u>

,
o(
9-V	o&
o
,Ho
rpo
Qo
rpo
Qo
rpo
QTݥ,h	o&
o
,Z	o&
o
J1Jo
rpo
Qo
rpo
Qo
rpo
Q	o&
o
To'
:7u>,o(
J3&*ALBb2KW80 o 
8o!
t
o3
r'po
o5
%9o~;:
s
%r1p(
%rQp(
%rp(
%rp(
%rp(
%r=p(
%rwp(
%rp(
%rp(
%rp	(
;~;(
9	E
,:HVdr8o&
r/po
}+|o&
}+no&
}+`o&
}+Ro&
}+Do&
}+6o&
}+(o&
}+o&
}+o&
}o'
:^u>,o(
*A0<!-*o 
+o!
t
(o'
-u>,o(
**0)"o 
8o!
t
o
o 
8o!
t{o
o
,T@
	{i/	{	o
rgp(
,o&
}o
rp(
,I(+@{o
o
,)@{i/{o&
(
o'
:>u>,o(
o'
:u>		,	o(
*A4'0O!o
o 
+%o!
t
o
r7p(
,(o'
-u>,o(
*1=0#
so
o 
8Qo!
to
rQp(
,o&
%	}	
8o
r{p(
,So&

	rspo
2.	o
o
}	Xo
o
}8	}8o
rwp(
9o
o 

+r
o!
to
r{p(
,Qo&
rspo
2-o
o
}Xo
o
}+}
o'
-
u>,o(
o'
:u>,o(
,{o
--*{o
*A4Vdy0O!o
o 
+%o!
t
o
rp(
,(o'
-u>,o(
*1=0$
o
o 

+@	o!
to
rp(
,	o&

+o
rp(
,o&
	o'
-	u>,o(
,{o
,*-~6
{o
*L\f(
}s
}*{*"}*0`%{-rp+r+po*

{o
+o!
too+
&o'
-u>
	,	o(
*'&MJ(
s}*{*"}*{*"}*0F&r=po*

{oo+
&rKpo*
((
o;
o+
&*Js
}	(
*{*"}*{	*"}	*0{'rcpo*

{oo+
&rqpo*
(o

+	o!
too+
&	o'
-	u>,o(
o+
&*7&]{
*"}
*{*"}*0(rpo*

rpo*
{
oo+
&rpo*
{o
+o!
t
	oo+
&o'
-u>,o(
o+
&o+
&*D(lJs
}(
*s
}s
}
s
}(
s}*{*"}*{*"}*{
*"}
*{*"}*{*"}*{*"}*0m)rpo*

{,rpo*
o+
&rpo*
(o
+o!
t
	oo+
&o'
-u>,o(
(o
	+	o!
too+
&	o'
-	u>

,
o(
(o
+o!
too+
&o'
-u>,o(
o+
&{,{oo+
&{,*rpo*
{o(o+
&o+
&*(A(i**{*"}*{*"}*0<rpo*

{oo+
&{,{oo+
&*(
*}}}(
}*}}}(
(}*{*"}*{*"}*{*"}*{*"}*0*r+po*

{oc
o;
{.%r5po*
|(1
o;
o+
&{.%r?po*
|(1
o;
o+
&{.%rSpo*

	|(1
o;
	o+
&*0m(Q
(R
,*;(Q
(R
,*9(Q
(R
,*M(Q
(R
,*N(Q
(R
,*Q(Q
(R
,*R(Q
(R
,*@(Q
(R
,*S(Q
(R
,*T(Q
(R
,*U(Q
(R
,	*V(Q
(R
,*W(Q
(R
,*X(Q
(R
,*O(Q
(R
,
*P(Q
(R
,*(Q
(R
,*oS
(~sT
z(
*V(
}}*V(
}}*V(
}}*{*"}*{*"}*{*"}*{*"}*{*"}*{*"}*{*"}*{*"}*0g+(,(o
8r_po*

{,{oo+
&rspo*
{,rpo*
o+
&+ rpo*

	(o;
	o+
&o+
&{,{oo+
&{,#rpo*
{o;
o+
&{,Arpo*
o+
&{oo+
&
{-(}{,;{sorpo*
o+
&o+
&**(
*:(
} *{ *"} *0)rpo*

{ ,{ oo+
&*(
*V(
}"}#*{#*"}#*{"*"}"*{!*"}!*0E&rpo*

{#,rpo*
o+
&{",{"oo+
&*vs
}$(
s
}$*{$*"}$*0Q,rpo*

{$o
+o!
too+
&o'
-u>
	,	o(
*&>:(
}%*{%*"}%*0${%,rpo*

{%o;
**V(
}'}(*r(
}'}(})*V(
}&})*{'*"}'*{(*"}(*{)*"})*{&*"}&*0-(,(o
+\rpo*

{', rpo*
{'o;
o+
&{(, rpo*
{(o;
o+
&{),:{)s
	orpo*
o+
&o+
&**(
*:(
}**{+*"}+*{,*"},*{**"}**0.{*,
{*o*rp
{,E8
*"2+6rp
+.r'p
+&r9p
+rAp
+rQp
+r[p
+ryp
o*
{+oo+
&*(
*{6*"}6*{8*"}8*{7*"}7*{:*"}:*{9*"}9*0/s

rpo*
{9,{9oo+
&+j{:,{:oo+
&+M{8,{8oo+
&+0{7,{7oo+
&+{6oo+
&o
o(5*0D0s

s
s
o
o

,o(
o
rpo
o&
*"
lSystem.Resources.ResourceReader, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089#System.Resources.RuntimeResourceSetPADPADPLNŜ%&{YN<+?l6C#z su@
NG^l8!@rm!,i3yUb$_Ɵ(_abֳbTl=xX+*75\EnC\>AcquireDatabaseConnectionFailedLAcquireDatabaseConnectionFailedMessage:AfterQueryBPBeforeQueryBP(ConnectingToDatabase(ConnectionIdNotFoundCreateTable$DMQueryStrinNotSet$0DTSVariableBindingFailedR:DatasourceInformationNotFound}DropTableEndQueryLogTextErrorSourceExecuteDMQuery*InputConnectionNotSet&InputDatabaseNotSetZInsertIntoTable$InvalidRootElement(NoMatchingResultName,OutputConnectionNotSet*OutputTablenameNotSetc6QueryExecutionFailedMessageResultNotSet&SetResultToVariable"StartQueryLogText4"SyncFailedMessageKTaskDescriptionkTaskDisplayName2UnsupportedConnectionType&UnsupportedDataType2ValidateTaskFailedMessage8Cannot acquire a connection from the connection manager.KFailed to connect to output database server due to the following error: {0} After query execution breakpoint!Before query execution breakpointConnect to output database(The '{0}' connection ID cannot be found.Create table {0},The data mining query statement is required.)Unable to bind to the DTS '{0}' variable.ECannot find DataSourceInformation schema from the connection manager.Drop table {0} End query executionExecuteDMQueryTaskExecute data mining query?An input connection to an Analysis Services server is required.+The mining model database name is required.Insert into table {0}DUnable to load properties. The persisted data appears to be damaged.5The '{0}' column cannot be found in the query result.FThe output connection to a relational database connection is required."The output table name is required.CFailed to execute data mining query due to the following error: {0}HThe '{0}' result variable has not been set due to an empty query result.Set query result to variableStart query executionSynchronization object failed.Execute data mining queryData Mining Query Task)The '{0}' connection type is unsupported.#The '{0}' data type is unsupported.@Failed to validate DM Query task due to the following error: {0}v  &   ( @颁ꨉꪌg2d0g2N&M&E"E"A _/W+r8o7W+s9r9F$t<l8w@yBzCp@{G}IsCL-yIzJQ{K}M~NUZ\[[TT\[UTgE`sNhlcoeqmrskurq|sw~ԕuꩉꪋ묍tâıºüpawǪ}ñ|cRqawgx~o¬űȮư̶ƷʼͿȼ`F2cI5hN:tZGw]Jx^KgT|dRkYkZo^tcp`|kvfuescwgueowg~nw}nwv{yʸȲʸµƹûpWC~fS|eRp]lZiWn\yiy=G5 F:'F:&"/D7&"	KA,#FP3@p`
F:&!qF:'!F:&
uF:+k)F:'6F:(rHF:%|}}}}}}}}}^z9$þsgeZfV_m1.ltZWOc[oh~v\T]oĝ~fYUXdoʣ~}}jboxsg{{iyaow~tZ~nNLE>4-h~NSRQJIC?<82ĝ~NMMB;0*ʣ~oxow~NLE>4-NSRQJIC?<82NMMB;0*???0?<???????( @ A A rA A oQA A s[sCA ĻA s\}MA sc`=q\}MA ueiWE"~[~NA yyN&t\~NɍF$|cRW+s\{KA ǿ_/s[{KA ƹn\g2s\zJE"Ĺ|dRzCs\zJM&o^Ts[zJW+˾µû}nes[yIg2tcp]ԕusZyIo7`F2cI5cI5cI5|eRcI5cI5cI5cI5˾ͿogTrUp@yBʸű¬Ǫºx^KsNTưǪüxpWC̶ȮhN:Ʒ}ñtZGue̶ȲhN:wıkYpa~olZ̶ʸhN:cI5cI5w|kp`wwgkZ̶ʼ|eRʸűȼȼ{qa̶hN:Ǫƺƺwgwgv묍ꪌꩉ~qcU{Gt<r8s9d0ȮhN:wg~fSyivfw]J~n묍â|umhl8ȲhN:ǼǼ묍ꪋꪋꨉ颁wk`T}Iw@r9ʸhN:̶ʼ|eR̶hN:묍ꪌꩉ~qcU{Gt<r8s9d0묍â|umhl8묍ꪋꪋꨉ颁wk`T}Iw@r9?????0<??????9s<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" xmlns:mssqlcrt="urn:sql-microsoft-com:sqlcrt" xmlns:mssqldbg="urn:sql-microsoft-com:sqldbg">
	<xsl:output method="xml" indent="yes"/>

	<!-- This ALWAYS GENERATED file contains the definitions for the cartridges
	             Microsoft Cartridge Interfaces (Analysis Services 2005)
	             (C) Copyright 1988 - 2003 By Microsoft Corporation.      -->

	<!-- SQL Server 2000 pluggable cartridge                              -->

	<!-- Area of STANDARD parametrizations: these are externally passed   -->
	<xsl:param name="in_CanUseParams">yes</xsl:param>
	<xsl:param name="in_IdentStartQuotingCharacter">"</xsl:param>
	<xsl:param name="in_IdentEndQuotingCharacter">"</xsl:param>
	<xsl:param name="in_StringStartQuotingCharacter">'</xsl:param>
	<xsl:param name="in_StringEndQuotingCharacter">'</xsl:param>
	
	<!-- Area of CORE parametrizations: These are externally checked      -->
	<mssqlcrt:provider>DB2/NT.08.01.0000</mssqlcrt:provider>	
	<mssqlcrt:provider type="prefix" managed="yes" native="yes">DB2</mssqlcrt:provider>
  <mssqlcrt:parameter-style native="unnamed" managed="named"/>

  <mssqlcrt:capabilities>
		<mssqlcrt:supports-datepart-year/>
		<mssqlcrt:supports-datepart-quarter/>
		<mssqlcrt:supports-datepart-month/>
		<mssqlcrt:supports-datepart-dayofyear/>
		<mssqlcrt:supports-datepart-day/>
		<mssqlcrt:supports-datepart-week/>
		<mssqlcrt:supports-datepart-dayofweek/>
		<mssqlcrt:supports-datepart-hour/>
		<mssqlcrt:supports-datepart-minute/>
		<mssqlcrt:supports-datepart-second/>
		<mssqlcrt:supports-datepart-millisecond/>
		<mssqlcrt:supports-multiple-distinct-count/>
		<mssqlcrt:supports-update/>
		<mssqlcrt:supports-insert/>
		<mssqlcrt:supports-subselect/>
		<mssqlcrt:supports-table-alias/>
		<mssqlcrt:supports-column-alias/>
		<mssqlcrt:supports-cast/>				
		<mssqlcrt:supports-union/>
		<mssqlcrt:supports-union-all/>
		<mssqlcrt:limit-table-identifier-length>29</mssqlcrt:limit-table-identifier-length>
		<mssqlcrt:limit-column-identifier-length>29</mssqlcrt:limit-column-identifier-length>
	</mssqlcrt:capabilities>

	<mssqlcrt:schema-classes>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.OleDb</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OleDbSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		    <mssqlcrt:query-designer>
			    <mssqlcrt:type>Microsoft.DataWarehouse.Controls.OleDbQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
		    </mssqlcrt:query-designer>
		</mssqlcrt:schema-class>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.Odbc</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OdbcSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		</mssqlcrt:schema-class>
	</mssqlcrt:schema-classes>

	<!-- Area of internal parametrizations                                -->
	<!-- overrideOfUseParams:
	         yes      = use always parametric queries
	         no       = never use parametric queries
			 nosubsel = use as yes, but not on subselects
			 auto     = use the value of in_CanUseParams to determine     -->
	<xsl:variable name="overrideOfUseParams">auto</xsl:variable>
	<!-- shouldProduceDebug:
	         yes      = produce debug information
	         no       = do not produce debug information                  -->
	<xsl:variable name="shouldProduceDebug">yes</xsl:variable>

	<!-- Area of global variables initializations                         -->
	<xsl:variable name="UseParams">
		<xsl:choose>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'yes' or (normalize-space($overrideOfUseParams) = 'auto' and normalize-space($in_CanUseParams)='yes')">yes</xsl:when>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'nosubsel'">nosubsel</xsl:when>
			<xsl:otherwise>no</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="ProduceDebug" select="$shouldProduceDebug"/>
	<xsl:variable name="IdentifierStartQuotingCharacter" select="normalize-space($in_IdentStartQuotingCharacter)"/>
	<xsl:variable name="IdentifierEndQuotingCharacter" select="normalize-space($in_IdentEndQuotingCharacter)"/>
	<xsl:variable name="StringStartQuotingCharacter" select="normalize-space($in_StringStartQuotingCharacter)"/>
	<xsl:variable name="StringEndQuotingCharacter" select="normalize-space($in_StringEndQuotingCharacter)"/>

	<!-- Generated statement packaging                                    -->
	<xsl:template match="/">
		<xsl:element name="Statement">

			<!-- Generate query                                           -->
			<xsl:element name="Text">
				<xsl:apply-templates select="./Statement/*[1]"/>
			</xsl:element>

			<!-- Generate parameters                                      -->
			<xsl:if test="count(./Statement/Parameters/Parameter)!=0 and ((normalize-space($UseParams)='yes') or (normalize-space($UseParams)='nosubsel'))">
				<xsl:element name="Parameters">
					<xsl:choose>
						<xsl:when test="/Statement/*[1]//Parameter/@ParamName">
							<xsl:for-each select="./Statement/Parameters/Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@id"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:for-each select="./Statement/*[1]//Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@ref"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
			</xsl:if>

			<!-- Generate debug info                                      -->
			<xsl:if test="$ProduceDebug='yes'">
				<xsl:element name="mssqldbg:DebugInfo">
					<xsl:element name="mssqldbg:GenerateParametricInfo">
						<xsl:attribute name="mssqldbg:Value">
							<xsl:value-of select="$UseParams"/>
						</xsl:attribute>
						<xsl:element name="mssqldbg:External">
							<xsl:value-of select="$in_CanUseParams"/>
						</xsl:element>
						<xsl:element name="mssqldbg:Internal">
							<xsl:value-of select="$overrideOfUseParams"/>
						</xsl:element>
					</xsl:element>
				</xsl:element>
			</xsl:if>

		</xsl:element>
	</xsl:template>

	<!-- Union statement                                                  -->
	<xsl:template match="Union">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Union All statement                                                  -->
	<xsl:template match="UnionAll">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION ALL '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Select statement                                                 -->
	<xsl:template match="Select">
		<xsl:choose>
			<xsl:when test="count(./ColumnExpressions/IsValidForIndexing) != 0">
				SELECT OBJECTPROPERTY( object_id('<xsl:apply-templates select="./Sources/View"/>'), 'isindexable' )
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
					(
				</xsl:if>
				SELECT <xsl:apply-templates select="./Top"/>
					<xsl:apply-templates select="./Distinct"/>
					<xsl:apply-templates select="./ColumnExpressions"/>
					<xsl:if test="count(../Phase) != 0">, COUNT_BIG(*) AS [COUNT_BIG_7673aff6-2445-4ef6-a4c9-7bf3d93bd42a] </xsl:if>
					<xsl:apply-templates select="./Sources"/>
					<xsl:apply-templates select="./Where"/>
					<xsl:apply-templates select="./GroupBy"/>
					<xsl:apply-templates select="./Having"/>
					<xsl:apply-templates select="./OrderBy"/>
				<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
					)
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Update statement                                                 -->
	<xsl:template match="Update">
		UPDATE <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Insert statement                                                 -->
	<xsl:template match="Insert">
		INSERT INTO <xsl:apply-templates select="./Target"/>
		<xsl:apply-templates select="./Select"/>
	</xsl:template>

	<!-- Delete statement                                                 -->
	<xsl:template match="Delete">
		DELETE FROM <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Drop statement                                                   -->
	<xsl:template match="Drop">
		DROP <xsl:apply-templates select="./*"/>
	</xsl:template>

	<!-- Create statement                                                 -->
	<xsl:template match="Create">
		CREATE 
		<xsl:variable name="phase"><xsl:value-of select="./Phase"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="number($phase)=1">
				VIEW <xsl:apply-templates select="./View"/> ( <xsl:apply-templates select="./*[4]"/>, [COUNT_BIG_7673aff6-2445-4ef6-a4c9-7bf3d93bd42a] ) WITH SCHEMABINDING AS <xsl:apply-templates select="./*[5]"/>
			</xsl:when>
			<xsl:when test="number($phase)=2">
				UNIQUE CLUSTERED INDEX <xsl:apply-templates select="./Index"/> ON <xsl:apply-templates select="./View"/> ( <xsl:apply-templates select="./*[4]"/> )
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select="./*[1]"/>
				<xsl:choose>
					<xsl:when test="name(./*[1]) = 'Table'"> ( <xsl:apply-templates select="./*[2]"/> )</xsl:when>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Distinct">
		DISTINCT
	</xsl:template>

	<xsl:template match="As">
		<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Sources">
		FROM <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnDefinitions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="GroupBy">
		GROUP BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="OrderBy">
		ORDER BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Where">
		WHERE <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="Having">
		HAVING <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="ColumnExpressions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnUpdates">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Assign">
		<xsl:apply-templates select="./*[1]"/>=<xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Insert/Target">
		<xsl:apply-templates select="./Table"/>
		(
			<xsl:call-template name="print-list">
				<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[1]"/>
			</xsl:call-template>
		)
		<xsl:if test="./*[2]/Assign">
			VALUES
			(
				<xsl:call-template name="print-list">
					<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[2]"/>
				</xsl:call-template>
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="Update/Target">
		<xsl:apply-templates select="./Table"/>
		SET <xsl:apply-templates select="./ColumnUpdates"/>
	</xsl:template>

	<xsl:template match="Delete/Target">
		<xsl:apply-templates select="./Table"/>
	</xsl:template>

	<xsl:template match="Insert/Target/ColumnUpdates/Assign/SQLColumn[1]">
		<!-- The table name is not printed for LHS of assignments in insert -->
		<xsl:apply-templates select="./Column"/>
	</xsl:template>

	<xsl:template match="Create/ColumnDefinitions/SQLColumn">
		<xsl:apply-templates select="./Column"/>
		<xsl:if test="count(../../Phase) = 0">
			<xsl:apply-templates select="./Type"/>
			<xsl:apply-templates select="./Usage"/>
		</xsl:if>
	</xsl:template>

	<xsl:template match="SQLColumn">
		<xsl:variable name="table">
			<xsl:if test="name(..)!='Count' or name(./Column/*[1]) != 'Asterisk'"><xsl:apply-templates select="./Table"/></xsl:if>
		</xsl:variable>
		<xsl:variable name="column">
			<xsl:apply-templates select="./Column"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$table = ''">
				<xsl:value-of select="$column"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($table,'.', $column)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Create/Database|Drop/Database">
		DATABASE <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Create/Table|Drop/Table">
		TABLE <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="View">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Drop/View">
		VIEW <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Index">
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Drop/Index">
		INDEX <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Column">
		<xsl:apply-templates select="./Asterisk"/>
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table/Name|View/Name|Index/Name|Column/Name|Database/Name|Schema">
		<xsl:call-template name="quote-identifier"/>
	</xsl:template>

	<xsl:template match="Usage">
		<xsl:variable name="usage"><xsl:value-of select="."/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$usage = 'Key'">    primary key   </xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="OpaqueExpression">
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			(
		</xsl:if>
		<xsl:value-of select="."/>
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="OrderExpression">
		<xsl:apply-templates select="./*[1]"/>
		<xsl:apply-templates select="./Asc"/>
		<xsl:apply-templates select="./Desc"/>
	</xsl:template>

	<xsl:template match="Asc">
		ASC
	</xsl:template>

	<xsl:template match="Desc">
		DESC
	</xsl:template>

	<!-- Print values: ? for parametric queries and convert expressions
	     for non-parametric queries                                       -->
	<xsl:template match="Parameter">
		<xsl:choose>
			<xsl:when test="$UseParams = 'yes' or $UseParams = 'nosubsel'">
				<xsl:choose>
					<xsl:when test="./@ParamName">
						@<xsl:value-of select="./@ParamName"/>
					</xsl:when>
					<xsl:otherwise>
						?
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="print-non-parametric-parameter-ref">
					<xsl:with-param name="parameter-reference" select="."/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- DatePart                                                         -->
	<xsl:template match="DatePart">
		<xsl:apply-templates select="./*[1]"/> ( <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- DatePartSpec                                                     -->
	<xsl:template match="DatePartSpec">
		<xsl:variable name="dps-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$dps-val = 'Year'">        year        </xsl:when>
			<xsl:when test="$dps-val = 'Quarter'">     quarter     </xsl:when>
			<xsl:when test="$dps-val = 'Month'">       month       </xsl:when>
			<xsl:when test="$dps-val = 'DayOfYear'">   dayofyear   </xsl:when>
			<xsl:when test="$dps-val = 'Day'">         day         </xsl:when>
			<xsl:when test="$dps-val = 'Week'">        week        </xsl:when>
			<xsl:when test="$dps-val = 'DayOfWeek'">   dayofweek   </xsl:when>
			<xsl:when test="$dps-val = 'Hour'">        hour        </xsl:when>
			<xsl:when test="$dps-val = 'Minute'">      minute      </xsl:when>
			<xsl:when test="$dps-val = 'Second'">      second      </xsl:when>
			<xsl:when test="$dps-val = 'Millisecond'"> microsecond </xsl:when>
		</xsl:choose>
	</xsl:template>

	<!-- Asterisk                                                         -->
	<xsl:template match="Asterisk">*</xsl:template>

	<!-- Count/Min/Max/Sum                                                -->
	<xsl:template match="Min|Max|Sum">
		<xsl:variable name="function">
			<xsl:choose>
				<xsl:when test="name()='Min'"> MIN </xsl:when>
				<xsl:when test="name()='Max'"> MAX </xsl:when>
				<xsl:when test="name()='Sum'"> SUM </xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$function"/>( <xsl:apply-templates select="./*[1]"/> )
	</xsl:template>

	<xsl:template match="Count">
		COUNT_BIG ( <xsl:apply-templates select="./*[1]"/> <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- Binary expressions                                               -->
	<!-- Equal/NotEqual/Greater/GreaterOrEqual/Less/LessOrEqual/In/And/Or/Plus/Minus/Divide/Multiply
	     expressions                                                      -->
	<xsl:template match="Equal|NotEqual|Greater|GreaterOrEqual|Less|LessOrEqual|In|And|Or|Plus|Minus|Divide|Multiply">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='Equal'">			=		</xsl:when>
				<xsl:when test="name()='NotEqual'">			&lt;&gt;	</xsl:when>
				<xsl:when test="name()='Greater'">			&gt;		</xsl:when>
				<xsl:when test="name()='GreaterOrEqual'">	&gt;=		</xsl:when>
				<xsl:when test="name()='Less'">				&lt;	</xsl:when>
				<xsl:when test="name()='LessOrEqual'">		&lt;=	</xsl:when>
				<xsl:when test="name()='In'">				IN		</xsl:when>
				<xsl:when test="name()='And'">				AND		</xsl:when>
				<xsl:when test="name()='Or'">				OR		</xsl:when>
				<xsl:when test="name()='Plus'">				+		</xsl:when>
				<xsl:when test="name()='Minus'">			-		</xsl:when>
				<xsl:when test="name()='Divide'">			/		</xsl:when>
				<xsl:when test="name()='Multiply'">			*		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="$operator"/>
			</xsl:call-template>
		)
	</xsl:template>

	<!-- Postfix unary expressions                                        -->
	<!-- IsNull
	     expressions                                                      -->
	<xsl:template match="IsNull">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='IsNull'">			IS NULL		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:apply-templates select="./*[1]"/>
			<xsl:value-of select="$operator"/>
		)
	</xsl:template>

	<!-- Types                                                            -->
	<xsl:template match="Type">
		<xsl:variable name="type-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$type-val = 'DBTYPE_BSTR'">    varchar     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_WSTR'">    varchar     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_STR'">     char        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_BOOL'">    smallint    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I1'">      smallint    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I2'">      smallint    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I4'">      integer     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I8'">      bigint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI1'">     smallint    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI2'">     smallint    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI4'">     integer     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI8'">     bigint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R4'">      real        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R8'">      float       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DATE'">    timestamp     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DBTIMESTAMP'">    timestamp     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_CY'">      double       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_VARIANT'"> varchar() for bit data    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_GUID'">    varchar     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_ByteArray'"> varchar() for bit data  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DECIMAL'"> decimal      </xsl:when>
		</xsl:choose>
		<xsl:apply-templates select="./Size"/>
		<xsl:apply-templates select="./Precision"/>
		<xsl:apply-templates select="./Scale"/>
	</xsl:template>

	<!-- Size (optional)                                                  -->
	<xsl:template match="Size">
	( <xsl:value-of select="./text()"/> )
	</xsl:template>
	
	<!-- Precision (optional)                                                  -->
	<xsl:template match="Precision">
	( <xsl:value-of select="./text()"/>
	</xsl:template>

	<!-- Scale (optional)                                                  -->
	<xsl:template match="Scale">
	, <xsl:value-of select="./text()"/> )
	</xsl:template>
	<!-- Cast                                                             -->
	<xsl:template match="Cast">
		CAST(<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>)
	</xsl:template>
	
	<!-- By default don't do anything                                     -->
	<xsl:template match="*">
	</xsl:template>

	<!-- Print a schema object                                               -->
	<xsl:template name="build-quoted-schema-object"> 
		<xsl:param name="schema-object-node" select="."/>

		<xsl:variable name="schema">
			<xsl:apply-templates select="$schema-object-node/Schema"/>
		</xsl:variable>
		<xsl:variable name="table">
			<xsl:apply-templates select="$schema-object-node/Name"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$schema = ''">
				<xsl:value-of select="$table"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($schema,'.', $table)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Convert an identifier to the OLEDB quotation form                -->
	<xsl:template name="quote-identifier"> 
		<xsl:param name="identifier" select="."/>

		<xsl:value-of select="$IdentifierStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$identifier"/>
			<xsl:with-param name="end-quoting-char" select="$IdentifierEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$IdentifierEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert a string to the string quotation form                    -->
	<xsl:template name="quote-string"> 
		<xsl:param name="string" select="."/>

		<xsl:value-of select="$StringStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$string"/>
			<xsl:with-param name="end-quoting-char" select="$StringEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$StringEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert an entity to the quotation form (recursive, aux)  by
         duplicating the end quoting character                            -->
	<xsl:template name="normalize-entity-aux"> 
		<xsl:param name="entity"/>
		<xsl:param name="end-quoting-char"/>

		<xsl:choose>
			<xsl:when test="contains($entity, $end-quoting-char)">
				<xsl:value-of select="substring-before($entity, $end-quoting-char)"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:call-template name="normalize-entity-aux">
					<xsl:with-param name="entity" select="substring-after($entity, $end-quoting-char)"/>
					<xsl:with-param name="end-quoting-char" select="$end-quoting-char"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$entity"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Print the children list                                          -->
	<xsl:template name="print-children-list">
		<xsl:param name="operator" select="','"/>
		
		<xsl:call-template name="print-list">
			<xsl:with-param name="value-node" select="./*"/>
			<xsl:with-param name="operator" select="$operator"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Print a list                                                     -->
	<xsl:template name="print-list">
		<xsl:param name="operator" select="','"/>
		<xsl:param name="value-node" select="."/>

		<xsl:for-each select="$value-node">
			<xsl:apply-templates select="."/>
			<xsl:if test="position()!=last()">
				<xsl:value-of select="$operator"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter-ref">
		<xsl:param name="parameter-reference"/>

		<xsl:variable name="reference"><xsl:value-of select="$parameter-reference/@ref"/></xsl:variable>
		<xsl:call-template name="print-non-parametric-parameter">
			<xsl:with-param name="parameter" select="/Statement/Parameters/Parameter[@id=$reference]"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter">
		<xsl:param name="parameter"/>

		<xsl:variable name="db-type"><xsl:value-of select="$parameter/@DBTYPE"/></xsl:variable>
		<xsl:variable name="value"><xsl:value-of select="$parameter/text()"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$db-type = 'DBTYPE_BSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_WSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_STR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_BOOL'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS bit)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DATE'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS timestamp)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DBTIMESTAMP'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS timestamp)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_CY'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS money)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_VARIANT'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
            <xsl:when test="$db-type = 'DBTYPE_GUID'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_ByteArray'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DECIMAL'"><xsl:value-of select="$value"/></xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
go<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" xmlns:mssqlcrt="urn:sql-microsoft-com:sqlcrt" xmlns:mssqldbg="urn:sql-microsoft-com:sqldbg">
	<xsl:output method="xml" indent="yes"/>

	<!-- This ALWAYS GENERATED file contains the definitions for the cartridges
	             Microsoft Cartridge Interfaces (Analysis Services 2005)
	             (C) Copyright 1988 - 2003 By Microsoft Corporation.      -->

	<!-- Microsoft Jet (Access DB) pluggable cartridge                    -->

	<!-- Area of STANDARD parametrizations: these are externally passed   -->
	<xsl:param name="in_CanUseParams">yes</xsl:param>
	<xsl:param name="in_IdentStartQuotingCharacter">[</xsl:param>
	<xsl:param name="in_IdentEndQuotingCharacter">]</xsl:param>
	<xsl:param name="in_StringStartQuotingCharacter">'</xsl:param>
	<xsl:param name="in_StringEndQuotingCharacter">'</xsl:param>
	<xsl:param name="in_IdentInvalidCharacters">[].!</xsl:param>
	
	<!-- Area of CORE parametrizations: These are externally checked      -->
	<mssqlcrt:provider type="prefix" managed="yes" native="yes">MS Jet</mssqlcrt:provider>
  <mssqlcrt:provider type="prefix" managed="yes" native="yes">ACCESS</mssqlcrt:provider>
  <mssqlcrt:parameter-style native="unnamed" managed="named"/>

	<!-- todo: add time support -->
	<mssqlcrt:capabilities>
		<mssqlcrt:supports-update/>
		<mssqlcrt:supports-insert/>
		<mssqlcrt:supports-subselect/>
		<mssqlcrt:supports-table-alias/>
		<mssqlcrt:supports-column-alias/>
		<mssqlcrt:supports-union/>
		<mssqlcrt:supports-union-all/>
		
		<mssqlcrt:limit-max-connections-count>4</mssqlcrt:limit-max-connections-count>
		
		<mssqlcrt:remote-connection-string-translation-behavior>1</mssqlcrt:remote-connection-string-translation-behavior>

		<!-- Map from MSDAInitialize connection string to SQLOLEDB connection string -->
		<mssqlcrt:remote-connection-string-mappings>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Provider</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property></mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Data Source</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>Database</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Initial Catalog</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property></mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>User ID</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>UID</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Password</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>PWD</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Persist Security Info</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property></mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
		</mssqlcrt:remote-connection-string-mappings>
	</mssqlcrt:capabilities>

	<mssqlcrt:schema-classes>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.OleDb</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OleDbSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		    <mssqlcrt:query-designer>
			    <mssqlcrt:type>Microsoft.DataWarehouse.Controls.OleDbQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
		    </mssqlcrt:query-designer>
		</mssqlcrt:schema-class>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.Odbc</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OdbcSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		</mssqlcrt:schema-class>
	</mssqlcrt:schema-classes>

	<!-- Area of internal parametrizations                                -->
	<!-- overrideOfUseParams:
	         yes      = use always parametric queries
	         no       = never use parametric queries
			 nosubsel = use as yes, but not on subselects
			 auto     = use the value of in_CanUseParams to determine     -->
	<xsl:variable name="overrideOfUseParams">auto</xsl:variable>
	<!-- shouldProduceDebug:
	         yes      = produce debug information
	         no       = do not produce debug information                  -->
	<xsl:variable name="shouldProduceDebug">yes</xsl:variable>

	<!-- Area of global variables initializations                         -->
	<xsl:variable name="UseParams">
		<xsl:choose>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'yes' or (normalize-space($overrideOfUseParams) = 'auto' and normalize-space($in_CanUseParams)='yes')">yes</xsl:when>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'nosubsel'">nosubsel</xsl:when>
			<xsl:otherwise>no</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="ProduceDebug" select="$shouldProduceDebug"/>
	<xsl:variable name="IdentifierStartQuotingCharacter" select="normalize-space($in_IdentStartQuotingCharacter)"/>
	<xsl:variable name="IdentifierEndQuotingCharacter" select="normalize-space($in_IdentEndQuotingCharacter)"/>
	<xsl:variable name="StringStartQuotingCharacter" select="normalize-space($in_StringStartQuotingCharacter)"/>
	<xsl:variable name="StringEndQuotingCharacter" select="normalize-space($in_StringEndQuotingCharacter)"/>

	<!-- Generated statement packaging                                    -->
	<xsl:template match="/">
		<xsl:element name="Statement">

			<!-- Generate query                                           -->
			<xsl:element name="Text">
				<xsl:apply-templates select="./Statement/*[1]"/>
			</xsl:element>

			<!-- Generate parameters                                      -->
			<xsl:if test="count(./Statement/Parameters/Parameter)!=0 and ((normalize-space($UseParams)='yes') or (normalize-space($UseParams)='nosubsel'))">
				<xsl:element name="Parameters">
					<xsl:choose>
						<xsl:when test="/Statement/*[1]//Parameter/@ParamName">
							<xsl:for-each select="./Statement/Parameters/Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@id"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:for-each select="./Statement/*[1]//Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@ref"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
			</xsl:if>

			<!-- Generate debug info                                      -->
			<xsl:if test="$ProduceDebug='yes'">
				<xsl:element name="mssqldbg:DebugInfo">
					<xsl:element name="mssqldbg:GenerateParametricInfo">
						<xsl:attribute name="mssqldbg:Value">
							<xsl:value-of select="$UseParams"/>
						</xsl:attribute>
						<xsl:element name="mssqldbg:External">
							<xsl:value-of select="$in_CanUseParams"/>
						</xsl:element>
						<xsl:element name="mssqldbg:Internal">
							<xsl:value-of select="$overrideOfUseParams"/>
						</xsl:element>
					</xsl:element>
				</xsl:element>
			</xsl:if>

		</xsl:element>
	</xsl:template>

	<!-- Union statement                                                  -->
	<xsl:template match="Union">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Union All statement                                                  -->
	<xsl:template match="UnionAll">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION ALL '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Select statement                                                 -->
	<xsl:template match="Select">
		<xsl:choose>
			<xsl:when test="name(./*[1])='ColumnExpressions' and name(./*[1]/*[1])='Count' and name(./*[1]/*[1]/*[1])='Distinct'">
				SELECT COUNT(*) FROM 
				( SELECT <xsl:apply-templates select="./ColumnExpressions/Count/Distinct"/> <xsl:apply-templates select="./*[1]/*[1]/*[2]"/>
				<xsl:apply-templates select="./Sources"/>
				<xsl:apply-templates select="./Where"/>
				<xsl:apply-templates select="./GroupBy"/> )
				AS [TableAlias]
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
					(
				</xsl:if>
				SELECT <xsl:apply-templates select="./Distinct"/>
					<xsl:apply-templates select="./ColumnExpressions"/>
					<xsl:apply-templates select="./Sources"/>
					<xsl:apply-templates select="./Where"/>
					<xsl:apply-templates select="./GroupBy"/>
					<xsl:apply-templates select="./OrderBy"/>
				<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
					)
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Update statement                                                 -->
	<xsl:template match="Update">
		UPDATE <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Insert statement                                                 -->
	<xsl:template match="Insert">
		INSERT INTO <xsl:apply-templates select="./Target"/>
		<xsl:apply-templates select="./Select"/>
	</xsl:template>

	<!-- Delete statement                                                 -->
	<xsl:template match="Delete">
		DELETE FROM <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Drop statement                                                   -->
	<xsl:template match="Drop">
		DROP <xsl:apply-templates select="./*"/>
	</xsl:template>

	<!-- Create statement                                                 -->
	<xsl:template match="Create">
		CREATE <xsl:apply-templates select="./*[1]"/>
		<xsl:choose>
			<xsl:when test="name(./*[1]) = 'Table'">( <xsl:apply-templates select="./*[2]"/> )</xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Distinct">
		DISTINCT
	</xsl:template>

	<xsl:template match="As">
		<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Sources">
		FROM <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnDefinitions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="GroupBy">
		GROUP BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="OrderBy">
		ORDER BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Where">
		WHERE <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="Having">
		HAVING <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="ColumnExpressions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnUpdates">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Assign">
		<xsl:apply-templates select="./*[1]"/>=<xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Insert/Target">
		<xsl:apply-templates select="./Table"/>
		(
			<xsl:call-template name="print-list">
				<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[1]"/>
			</xsl:call-template>
		)
		<xsl:if test="./*[2]/Assign">
			VALUES
			(
				<xsl:call-template name="print-list">
					<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[2]"/>
				</xsl:call-template>
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="Update/Target">
		<xsl:apply-templates select="./Table"/>
		SET <xsl:apply-templates select="./ColumnUpdates"/>
	</xsl:template>

	<xsl:template match="Delete/Target">
		<xsl:apply-templates select="./Table"/>
	</xsl:template>

	<xsl:template match="Insert/Target/ColumnUpdates/Assign/SQLColumn[1]">
		<!-- The table name is not printed for LHS of assignments in insert -->
		<xsl:apply-templates select="./Column"/>
	</xsl:template>

	<xsl:template match="Create/ColumnDefinitions/SQLColumn">
		<xsl:apply-templates select="./Column"/>
		<xsl:apply-templates select="./Type"/>
		<xsl:apply-templates select="./Usage"/>
	</xsl:template>

	<xsl:template match="SQLColumn">
		<xsl:variable name="table">
			<xsl:if test="name(..)!='Count' or name(./Column/*[1]) != 'Asterisk'"><xsl:apply-templates select="./Table"/></xsl:if>
		</xsl:variable>
		<xsl:variable name="column">
			<xsl:apply-templates select="./Column"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$table = ''">
				<xsl:value-of select="$column"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($table,'.', $column)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Create/Database|Drop/Database">
		DATABASE <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Create/Table|Drop/Table">
		TABLE <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="View">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Drop/View">
		VIEW <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Index">
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Drop/Index">
		INDEX <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Column">
		<xsl:apply-templates select="./Asterisk"/>
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table/Name|View/Name|Index/Name|Column/Name|Database/Name|Schema">
		<xsl:call-template name="quote-identifier"/>
	</xsl:template>

	<xsl:template match="Usage">
		<xsl:variable name="usage"><xsl:value-of select="."/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$usage = 'Key'">    primary key   </xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="OpaqueExpression">
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			(
		</xsl:if>
		<xsl:value-of select="."/>
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="OrderExpression">
		<xsl:apply-templates select="./*[1]"/>
		<xsl:apply-templates select="./Asc"/>
		<xsl:apply-templates select="./Desc"/>
	</xsl:template>

	<xsl:template match="Asc">
		ASC
	</xsl:template>

	<xsl:template match="Desc">
		DESC
	</xsl:template>

	<!-- Print values: ? for parametric queries and convert expressions
	     for non-parametric queries                                       -->
	<xsl:template match="Parameter">
		<xsl:choose>
			<xsl:when test="$UseParams = 'yes' or $UseParams = 'nosubsel'">
				<xsl:choose>
					<xsl:when test="./@ParamName">
						@<xsl:value-of select="./@ParamName"/>
					</xsl:when>
					<xsl:otherwise>
						?
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="print-non-parametric-parameter-ref">
					<xsl:with-param name="parameter-reference" select="."/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Asterisk                                                         -->
	<xsl:template match="Asterisk">*</xsl:template>

	<!-- Count/Min/Max/Sum                                                -->
	<xsl:template match="Count|Min|Max|Sum">
		<xsl:variable name="function">
			<xsl:choose>
				<xsl:when test="name()='Count'"> COUNT </xsl:when>
				<xsl:when test="name()='Min'"> MIN </xsl:when>
				<xsl:when test="name()='Max'"> MAX </xsl:when>
				<xsl:when test="name()='Sum'"> SUM </xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$function"/>( <xsl:apply-templates select="./*[1]"/> )
	</xsl:template>

	<!-- Binary expressions                                               -->
	<!-- Equal/NotEqual/Greater/GreaterOrEqual/Less/LessOrEqual/In/And/Or/Plus/Minus/Divide/Multiply
	     expressions                                                      -->
	<xsl:template match="Equal|NotEqual|Greater|GreaterOrEqual|Less|LessOrEqual|In|And|Or|Plus|Minus|Divide|Multiply">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='Equal'">			=		</xsl:when>
				<xsl:when test="name()='NotEqual'">			&lt;&gt;	</xsl:when>
				<xsl:when test="name()='Greater'">			&gt;		</xsl:when>
				<xsl:when test="name()='GreaterOrEqual'">	&gt;=		</xsl:when>
				<xsl:when test="name()='Less'">				&lt;	</xsl:when>
				<xsl:when test="name()='LessOrEqual'">		&lt;=	</xsl:when>
				<xsl:when test="name()='In'">				IN		</xsl:when>
				<xsl:when test="name()='And'">				AND		</xsl:when>
				<xsl:when test="name()='Or'">				OR		</xsl:when>
				<xsl:when test="name()='Plus'">				+		</xsl:when>
				<xsl:when test="name()='Minus'">			-		</xsl:when>
				<xsl:when test="name()='Divide'">			/		</xsl:when>
				<xsl:when test="name()='Multiply'">			*		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="$operator"/>
			</xsl:call-template>
		)
	</xsl:template>

	<!-- Postfix unary expressions                                        -->
	<!-- IsNull
	     expressions                                                      -->
	<xsl:template match="IsNull">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='IsNull'">			IS NULL		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:apply-templates select="./*[1]"/>
			<xsl:value-of select="$operator"/>
		)
	</xsl:template>

	<!-- Types                                                            -->
	<xsl:template match="Type">
		<xsl:variable name="type-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$type-val = 'DBTYPE_BSTR'">    varchar      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_WSTR'">    varchar      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_STR'">     varchar      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_BOOL'">    bit          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I1'">      tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I2'">      smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I4'">      int          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I8'">      long         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI1'">     tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI2'">     smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI4'">     int          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI8'">     long         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R4'">      float        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R8'">      real         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DATE'">    datetime     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DBTIMESTAMP'">    datetime     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_CY'">      money        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_VARIANT'"> sql_variant  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_GUID'"> guid </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_ByteArray'"> varbinary  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DECIMAL'"> decimal      </xsl:when>
		</xsl:choose>
		<xsl:apply-templates select="./Size"/>
		<xsl:apply-templates select="./Precision"/>
		<xsl:apply-templates select="./Scale"/>
	</xsl:template>

	<!-- Size (optional)                                                  -->
	<xsl:template match="Size">
	( <xsl:value-of select="./text()"/> )
	</xsl:template>
	
	<!-- Precision (optional)                                                  -->
	<xsl:template match="Precision">
	( <xsl:value-of select="./text()"/>
	</xsl:template>

	<!-- Scale (optional)                                                  -->
	<xsl:template match="Scale">
	, <xsl:value-of select="./text()"/> )
	</xsl:template>	
	<!-- By default don't do anything                                     -->
	<xsl:template match="*">
	</xsl:template>

	<!-- Print a schema object                                               -->
	<xsl:template name="build-quoted-schema-object"> 
		<xsl:param name="schema-object-node" select="."/>

		<xsl:variable name="schema">
			<xsl:apply-templates select="$schema-object-node/Schema"/>
		</xsl:variable>
		<xsl:variable name="table">
			<xsl:apply-templates select="$schema-object-node/Name"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$schema = ''">
				<xsl:value-of select="$table"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($schema,'.', $table)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Convert an identifier to the OLEDB quotation form                -->
	<xsl:template name="quote-identifier"> 
		<xsl:param name="identifier" select="."/>

		<xsl:value-of select="$IdentifierStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$identifier"/>
			<xsl:with-param name="end-quoting-char" select="$IdentifierEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$IdentifierEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert a string to the string quotation form                    -->
	<xsl:template name="quote-string"> 
		<xsl:param name="string" select="."/>

		<xsl:value-of select="$StringStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$string"/>
			<xsl:with-param name="end-quoting-char" select="$StringEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$StringEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert an entity to the quotation form (recursive, aux)  by
         duplicating the end quoting character                            -->
	<xsl:template name="normalize-entity-aux"> 
		<xsl:param name="entity"/>
		<xsl:param name="end-quoting-char"/>

		<xsl:choose>
			<xsl:when test="contains($entity, $end-quoting-char)">
				<xsl:value-of select="substring-before($entity, $end-quoting-char)"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:call-template name="normalize-entity-aux">
					<xsl:with-param name="entity" select="substring-after($entity, $end-quoting-char)"/>
					<xsl:with-param name="end-quoting-char" select="$end-quoting-char"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$entity"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Print the children list                                          -->
	<xsl:template name="print-children-list">
		<xsl:param name="operator" select="','"/>
		
		<xsl:call-template name="print-list">
			<xsl:with-param name="value-node" select="./*"/>
			<xsl:with-param name="operator" select="$operator"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Print a list                                                     -->
	<xsl:template name="print-list">
		<xsl:param name="operator" select="','"/>
		<xsl:param name="value-node" select="."/>

		<xsl:for-each select="$value-node">
			<xsl:apply-templates select="."/>
			<xsl:if test="position()!=last()">
				<xsl:value-of select="$operator"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter-ref">
		<xsl:param name="parameter-reference"/>

		<xsl:variable name="reference"><xsl:value-of select="$parameter-reference/@ref"/></xsl:variable>
		<xsl:call-template name="print-non-parametric-parameter">
			<xsl:with-param name="parameter" select="/Statement/Parameters/Parameter[@id=$reference]"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter">
		<xsl:param name="parameter"/>

		<xsl:variable name="db-type"><xsl:value-of select="$parameter/@DBTYPE"/></xsl:variable>
		<xsl:variable name="value"><xsl:value-of select="$parameter/text()"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$db-type = 'DBTYPE_BSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_WSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_STR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_BOOL'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS bit)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DATE'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS datetime)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DBTIMESTAMP'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS datetime)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_CY'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS money)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_VARIANT'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
            <xsl:when test="$db-type = 'DBTYPE_GUID'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_ByteArray'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DECIMAL'"><xsl:value-of select="$value"/></xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
:}<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" xmlns:mssqlcrt="urn:sql-microsoft-com:sqlcrt" xmlns:mssqldbg="urn:sql-microsoft-com:sqldbg">
	<xsl:output method="xml" indent="yes"/>

	<!-- This ALWAYS GENERATED file contains the definitions for the cartridges
	             Microsoft Cartridge Interfaces (Analysis Services 2005)
	             (C) Copyright 1988 - 2003 By Microsoft Corporation.      -->

	<!-- Oracle 7 pluggable cartridge                              -->

	<!-- Area of STANDARD parametrizations: these are externally passed   -->
	<xsl:param name="in_CanUseParams">yes</xsl:param>
	<xsl:param name="in_IdentStartQuotingCharacter">"</xsl:param>
	<xsl:param name="in_IdentEndQuotingCharacter">"</xsl:param>
	<xsl:param name="in_StringStartQuotingCharacter">'</xsl:param>
	<xsl:param name="in_StringEndQuotingCharacter">'</xsl:param>
	
	<!-- Area of CORE parametrizations: These are externally checked      -->
	<mssqlcrt:provider type="prefix" managed="yes" native="yes">Oracle</mssqlcrt:provider>
  <mssqlcrt:parameter-style native="unnamed" managed="named"/>

	<mssqlcrt:capabilities>
		<mssqlcrt:supports-datepart-year/>
		<mssqlcrt:supports-datepart-quarter/>
		<mssqlcrt:supports-datepart-month/>
		<mssqlcrt:supports-datepart-dayofyear/>
		<mssqlcrt:supports-datepart-day/>
		<mssqlcrt:supports-datepart-week/>
		<mssqlcrt:supports-datepart-dayofweek/>
		<mssqlcrt:supports-datepart-hour/>
		<mssqlcrt:supports-datepart-minute/>
		<mssqlcrt:supports-datepart-second/>
		<mssqlcrt:supports-datepart-millisecond/>
		<mssqlcrt:supports-multiple-distinct-count/>
		<mssqlcrt:supports-update/>
		<mssqlcrt:supports-insert/>
		<mssqlcrt:supports-subselect/>
		<mssqlcrt:supports-table-alias/>
		<mssqlcrt:supports-column-alias/>
		<mssqlcrt:supports-cast/>
		<mssqlcrt:supports-union/>
		<mssqlcrt:supports-union-all/>
		<mssqlcrt:supports-remote-query/>
		<mssqlcrt:supports-materialized-view>2</mssqlcrt:supports-materialized-view>
		<mssqlcrt:limit-materialized-view-column-count>255</mssqlcrt:limit-materialized-view-column-count>
		<mssqlcrt:limit-table-identifier-length>30</mssqlcrt:limit-table-identifier-length>
		<mssqlcrt:limit-column-identifier-length>30</mssqlcrt:limit-column-identifier-length>

		<!-- Don't use provider-string format, instead split into DataSource, Username, Password -->
		<mssqlcrt:remote-connection-string-translation-behavior>2</mssqlcrt:remote-connection-string-translation-behavior>
		
		<!-- Map from MSDAInitialize connection string to components -->
		<mssqlcrt:remote-connection-string-mappings>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Provider</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property></mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>DataSource</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>Data Source</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>UserName</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>User ID</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Password</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>Password</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
		</mssqlcrt:remote-connection-string-mappings>		
	</mssqlcrt:capabilities>

	<mssqlcrt:schema-classes>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.OracleClient</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OracleSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		    <mssqlcrt:query-designer>
			    <mssqlcrt:type>Microsoft.DataWarehouse.Controls.OracleQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
		    </mssqlcrt:query-designer>
		</mssqlcrt:schema-class>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.OleDb</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OleDbSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		    <mssqlcrt:query-designer>
			    <mssqlcrt:type>Microsoft.DataWarehouse.Controls.OleDbQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
		    </mssqlcrt:query-designer>
		</mssqlcrt:schema-class>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.Odbc</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OdbcSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		</mssqlcrt:schema-class>
	</mssqlcrt:schema-classes>

	<!-- Area of internal parametrizations                                -->
	<!-- overrideOfUseParams:
	         yes      = use always parametric queries
	         no       = never use parametric queries
			 nosubsel = use as yes, but not on subselects
			 auto     = use the value of in_CanUseParams to determine     -->
	<xsl:variable name="overrideOfUseParams">auto</xsl:variable>
	<!-- shouldProduceDebug:
	         yes      = produce debug information
	         no       = do not produce debug information                  -->
	<xsl:variable name="shouldProduceDebug">yes</xsl:variable>

	<!-- Area of global variables initializations                         -->
	<xsl:variable name="UseParams">
		<xsl:choose>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'yes' or (normalize-space($overrideOfUseParams) = 'auto' and normalize-space($in_CanUseParams)='yes')">yes</xsl:when>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'nosubsel'">nosubsel</xsl:when>
			<xsl:otherwise>no</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="ProduceDebug" select="$shouldProduceDebug"/>
	<xsl:variable name="IdentifierStartQuotingCharacter" select="normalize-space($in_IdentStartQuotingCharacter)"/>
	<xsl:variable name="IdentifierEndQuotingCharacter" select="normalize-space($in_IdentEndQuotingCharacter)"/>
	<xsl:variable name="StringStartQuotingCharacter" select="normalize-space($in_StringStartQuotingCharacter)"/>
	<xsl:variable name="StringEndQuotingCharacter" select="normalize-space($in_StringEndQuotingCharacter)"/>

	<!-- Generated statement packaging                                    -->
	<xsl:template match="/">
		<xsl:element name="Statement">

			<!-- Generate query                                           -->
			<xsl:element name="Text">
				<xsl:apply-templates select="./Statement/*[1]"/>
			</xsl:element>

			<!-- Generate parameters                                      -->
			<xsl:if test="count(./Statement/Parameters/Parameter)!=0 and ((normalize-space($UseParams)='yes') or (normalize-space($UseParams)='nosubsel'))">
				<xsl:element name="Parameters">
					<xsl:choose>
						<xsl:when test="/Statement/*[1]//Parameter/@ParamName">
							<xsl:for-each select="./Statement/Parameters/Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@id"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:for-each select="./Statement/*[1]//Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@ref"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
			</xsl:if>

			<!-- Generate debug info                                      -->
			<xsl:if test="$ProduceDebug='yes'">
				<xsl:element name="mssqldbg:DebugInfo">
					<xsl:element name="mssqldbg:GenerateParametricInfo">
						<xsl:attribute name="mssqldbg:Value">
							<xsl:value-of select="$UseParams"/>
						</xsl:attribute>
						<xsl:element name="mssqldbg:External">
							<xsl:value-of select="$in_CanUseParams"/>
						</xsl:element>
						<xsl:element name="mssqldbg:Internal">
							<xsl:value-of select="$overrideOfUseParams"/>
						</xsl:element>
					</xsl:element>
				</xsl:element>
			</xsl:if>

		</xsl:element>
	</xsl:template>

	<!-- Union statement                                                  -->
	<xsl:template match="Union">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Union All statement                                                  -->
	<xsl:template match="UnionAll">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION ALL '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Select statement                                                 -->
	<xsl:template match="Select">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
			(
		</xsl:if>
		SELECT <xsl:apply-templates select="./Top"/>
			<xsl:apply-templates select="./Distinct"/>
			<xsl:apply-templates select="./ColumnExpressions"/>
			<xsl:apply-templates select="./Sources"/>
			<xsl:apply-templates select="./Where"/>
			<xsl:apply-templates select="./GroupBy"/>
			<xsl:apply-templates select="./OrderBy"/>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Update statement                                                 -->
	<xsl:template match="Update">
		UPDATE <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Insert statement                                                 -->
	<xsl:template match="Insert">
		INSERT INTO <xsl:apply-templates select="./Target"/>
		<xsl:apply-templates select="./Select"/>
	</xsl:template>

	<!-- Delete statement                                                 -->
	<xsl:template match="Delete">
		DELETE FROM <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Drop statement                                                   -->
	<xsl:template match="Drop">
		<xsl:choose>
			<xsl:when test="count(./Phase) = 0">
				DROP <xsl:apply-templates select="./*"/>
			</xsl:when>
			<xsl:otherwise>
				DROP MATERIALIZED <xsl:apply-templates select="./*"/>
		        </xsl:otherwise>
	        </xsl:choose>
	</xsl:template>

	<!-- Create statement                                                 -->
	<xsl:template match="Create">
		CREATE 
        <xsl:variable name="phase"><xsl:value-of select="./Phase"/></xsl:variable>
        <xsl:choose>
            <xsl:when test="number($phase)=1">
			    MATERIALIZED VIEW <xsl:apply-templates select="./View"/> REFRESH ON COMMIT AS <xsl:apply-templates select="./*[5]"/>
			</xsl:when>
            <xsl:when test="number($phase)=2">
			    UNIQUE INDEX <xsl:apply-templates select="./Index"/> ON <xsl:apply-templates select="./View"/> ( <xsl:apply-templates select="./*[4]"/> )
            </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates select="./*[1]"/>
		        <xsl:choose>
			        <xsl:when test="name(./*[1]) = 'Table'">( <xsl:apply-templates select="./*[2]"/> )</xsl:when>
		        </xsl:choose>
            </xsl:otherwise>
        </xsl:choose>
	</xsl:template>

	<xsl:template match="Distinct">
		DISTINCT
	</xsl:template>

	<xsl:template match="As">
		<xsl:apply-templates select="./*[1]"/><xsl:text> </xsl:text><xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Sources">
		FROM <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnDefinitions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="GroupBy">
		GROUP BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="OrderBy">
		ORDER BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Where">
		WHERE <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="Having">
		HAVING <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="ColumnExpressions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnUpdates">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Assign">
		<xsl:apply-templates select="./*[1]"/>=<xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Insert/Target">
		<xsl:apply-templates select="./Table"/>
		(
			<xsl:call-template name="print-list">
				<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[1]"/>
			</xsl:call-template>
		)
		<xsl:if test="./*[2]/Assign">
			VALUES
			(
				<xsl:call-template name="print-list">
					<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[2]"/>
				</xsl:call-template>
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="Update/Target">
		<xsl:apply-templates select="./Table"/>
		SET <xsl:apply-templates select="./ColumnUpdates"/>
	</xsl:template>

	<xsl:template match="Delete/Target">
		<xsl:apply-templates select="./Table"/>
	</xsl:template>

	<xsl:template match="Insert/Target/ColumnUpdates/Assign/SQLColumn[1]">
		<!-- The table name is not printed for LHS of assignments in insert -->
		<xsl:apply-templates select="./Column"/>
	</xsl:template>

	<xsl:template match="Create/ColumnDefinitions/SQLColumn">
		<xsl:apply-templates select="./Column"/>
		<xsl:if test="count(../../Phase) = 0">
			<xsl:apply-templates select="./Type"/>
			<xsl:apply-templates select="./Usage"/>
		</xsl:if>
	</xsl:template>

	<xsl:template match="SQLColumn">
		<xsl:variable name="table">
			<xsl:if test="name(..)!='Count' or name(./Column/*[1]) != 'Asterisk'"><xsl:apply-templates select="./Table"/></xsl:if>
		</xsl:variable>
		<xsl:variable name="column">
			<xsl:apply-templates select="./Column"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$table = ''">
				<xsl:value-of select="$column"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($table,'.', $column)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Create/Database|Drop/Database">
		DATABASE <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Create/Table|Drop/Table">
		TABLE <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="View">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Drop/View">
		VIEW <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Index">
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Drop/Index">
		INDEX <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Column">
		<xsl:apply-templates select="./Asterisk"/>
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table/Name|View/Name|Index/Name|Column/Name|Database/Name|Schema">
		<xsl:call-template name="quote-identifier"/>
	</xsl:template>

	<xsl:template match="Usage">
		<xsl:variable name="usage"><xsl:value-of select="."/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$usage = 'Key'">    primary key   </xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="OpaqueExpression">
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			(
		</xsl:if>
		<xsl:value-of select="."/>
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="OrderExpression">
		<xsl:apply-templates select="./*[1]"/>
		<xsl:apply-templates select="./Asc"/>
		<xsl:apply-templates select="./Desc"/>
	</xsl:template>

	<xsl:template match="Asc">
		ASC
	</xsl:template>

	<xsl:template match="Desc">
		DESC
	</xsl:template>

	<!-- Print values: ? for parametric queries and convert expressions
	     for non-parametric queries                                       -->
	<xsl:template match="Parameter">
		<xsl:choose>
			<xsl:when test="$UseParams = 'yes' or $UseParams = 'nosubsel'">
				<xsl:choose>
					<xsl:when test="./@ParamName">
						:<xsl:value-of select="./@ParamName"/>
					</xsl:when>
					<xsl:otherwise>
						?
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="print-non-parametric-parameter-ref">
					<xsl:with-param name="parameter-reference" select="."/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- DatePart                                                         -->
	<xsl:template match="DatePart">
		DATEPART( <xsl:apply-templates select="./*[1]"/> , <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- DatePartSpec                                                     -->
	<xsl:template match="DatePartSpec">
		<xsl:variable name="dps-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$dps-val = 'Year'">        year        </xsl:when>
			<xsl:when test="$dps-val = 'Quarter'">     quarter     </xsl:when>
			<xsl:when test="$dps-val = 'Month'">       month       </xsl:when>
			<xsl:when test="$dps-val = 'DayOfYear'">   dayofyear   </xsl:when>
			<xsl:when test="$dps-val = 'Day'">         day         </xsl:when>
			<xsl:when test="$dps-val = 'Week'">        week        </xsl:when>
			<xsl:when test="$dps-val = 'DayOfWeek'">   weekday     </xsl:when>
			<xsl:when test="$dps-val = 'Hour'">        hour        </xsl:when>
			<xsl:when test="$dps-val = 'Minute'">      minute      </xsl:when>
			<xsl:when test="$dps-val = 'Second'">      second      </xsl:when>
			<xsl:when test="$dps-val = 'Millisecond'"> millisecond </xsl:when>
		</xsl:choose>
	</xsl:template>

	<!-- Asterisk                                                         -->
	<xsl:template match="Asterisk">*</xsl:template>

	<!-- Count/Min/Max/Sum                                                -->
	<xsl:template match="Min|Max|Sum">
		<xsl:variable name="function">
			<xsl:choose>
				<xsl:when test="name()='Min'"> MIN </xsl:when>
				<xsl:when test="name()='Max'"> MAX </xsl:when>
				<xsl:when test="name()='Sum'"> SUM </xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$function"/>( <xsl:apply-templates select="./*[1]"/> )
	</xsl:template>

	<xsl:template match="Count">
		COUNT ( <xsl:apply-templates select="./*[1]"/> <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- Binary expressions                                               -->
	<!-- Equal/NotEqual/Greater/GreaterOrEqual/Less/LessOrEqual/In/And/Or/Plus/Minus/Divide/Multiply
	     expressions                                                      -->
	<xsl:template match="Equal|NotEqual|Greater|GreaterOrEqual|Less|LessOrEqual|In|And|Or|Plus|Minus|Divide|Multiply">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='Equal'">			=		</xsl:when>
				<xsl:when test="name()='NotEqual'">			&lt;&gt;	</xsl:when>
				<xsl:when test="name()='Greater'">			&gt;		</xsl:when>
				<xsl:when test="name()='GreaterOrEqual'">	&gt;=		</xsl:when>
				<xsl:when test="name()='Less'">				&lt;	</xsl:when>
				<xsl:when test="name()='LessOrEqual'">		&lt;=	</xsl:when>
				<xsl:when test="name()='In'">				IN		</xsl:when>
				<xsl:when test="name()='And'">				AND		</xsl:when>
				<xsl:when test="name()='Or'">				OR		</xsl:when>
				<xsl:when test="name()='Plus'">				+		</xsl:when>
				<xsl:when test="name()='Minus'">			-		</xsl:when>
				<xsl:when test="name()='Divide'">			/		</xsl:when>
				<xsl:when test="name()='Multiply'">			*		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="$operator"/>
			</xsl:call-template>
		)
	</xsl:template>

	<!-- Postfix unary expressions                                        -->
	<!-- IsNull
	     expressions                                                      -->
	<xsl:template match="IsNull">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='IsNull'">			IS NULL		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:apply-templates select="./*[1]"/>
			<xsl:value-of select="$operator"/>
		)
	</xsl:template>

	<!-- Types                                                            -->
	<xsl:template match="Type">
		<xsl:variable name="type-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$type-val = 'DBTYPE_BSTR'">    varchar2    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_WSTR'">    varchar2    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_STR'">     varchar2    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_BOOL'">    number(1,0) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I1'">      number(3,0) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I2'">      number(5,0) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I4'">      number(10,0) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I8'">      number(19,0) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI1'">     number(3,0) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI2'">     number(5,0) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI4'">     number(10,0) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI8'">     number(19,0) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R4'">      number       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R8'">      float 	</xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DATE'">    date         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DBTIMESTAMP'">    date  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_CY'">      number       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_VARIANT'"> number       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_GUID'">    varchar2     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_ByteArray'"> long raw  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DECIMAL'"> number </xsl:when>
		</xsl:choose>
		<xsl:apply-templates select="./Size"/>
		<xsl:apply-templates select="./Precision"/>
		<xsl:apply-templates select="./Scale"/>
	</xsl:template>

	<!-- Size (optional)                                                  -->
	<xsl:template match="Size">
	( <xsl:value-of select="./text()"/> )
	</xsl:template>
	
	<!-- Precision (optional)                                                  -->
	<xsl:template match="Precision">
	( <xsl:value-of select="./text()"/>
	</xsl:template>

	<!-- Scale (optional)                                                  -->
	<xsl:template match="Scale">
	, <xsl:value-of select="./text()"/> )
	</xsl:template>
	<!-- Cast                                                             -->
	<xsl:template match="Cast">
		CAST(<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>)
	</xsl:template>
	
	<!-- By default don't do anything                                     -->
	<xsl:template match="*">
	</xsl:template>

	<!-- Print a schema object                                               -->
	<xsl:template name="build-quoted-schema-object"> 
		<xsl:param name="schema-object-node" select="."/>

		<xsl:variable name="schema">
			<xsl:apply-templates select="$schema-object-node/Schema"/>
		</xsl:variable>
		<xsl:variable name="table">
			<xsl:apply-templates select="$schema-object-node/Name"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$schema = ''">
				<xsl:value-of select="$table"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($schema,'.', $table)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Convert an identifier to the OLEDB quotation form                -->
	<xsl:template name="quote-identifier"> 
		<xsl:param name="identifier" select="."/>

		<xsl:value-of select="$IdentifierStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$identifier"/>
			<xsl:with-param name="end-quoting-char" select="$IdentifierEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$IdentifierEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert a string to the string quotation form                    -->
	<xsl:template name="quote-string"> 
		<xsl:param name="string" select="."/>

		<xsl:value-of select="$StringStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$string"/>
			<xsl:with-param name="end-quoting-char" select="$StringEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$StringEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert an entity to the quotation form (recursive, aux)  by
         duplicating the end quoting character                            -->
	<xsl:template name="normalize-entity-aux"> 
		<xsl:param name="entity"/>
		<xsl:param name="end-quoting-char"/>

		<xsl:choose>
			<xsl:when test="contains($entity, $end-quoting-char)">
				<xsl:value-of select="substring-before($entity, $end-quoting-char)"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:call-template name="normalize-entity-aux">
					<xsl:with-param name="entity" select="substring-after($entity, $end-quoting-char)"/>
					<xsl:with-param name="end-quoting-char" select="$end-quoting-char"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$entity"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Print the children list                                          -->
	<xsl:template name="print-children-list">
		<xsl:param name="operator" select="','"/>
		
		<xsl:call-template name="print-list">
			<xsl:with-param name="value-node" select="./*"/>
			<xsl:with-param name="operator" select="$operator"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Print a list                                                     -->
	<xsl:template name="print-list">
		<xsl:param name="operator" select="','"/>
		<xsl:param name="value-node" select="."/>

		<xsl:for-each select="$value-node">
            <xsl:variable name="phase"><xsl:value-of select="../../../Phase"/></xsl:variable>
            <xsl:choose>
                <xsl:when test="number($phase) = 1 and name($value-node) = 'ColumnExpressions'">
                    <xsl:call-template name="print-view-column">
                        <xsl:with-param name="parameter" select="./*[1]"/>
                        <xsl:with-param name="pos" select="position()"/>
                    </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
			        <xsl:apply-templates select="."/>
                </xsl:otherwise>
            </xsl:choose>
			<xsl:if test="position()!=last()">
				<xsl:value-of select="$operator"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

    <xsl:template name="print-view-column">
        <xsl:param name="parameter"/>
        <xsl:param name="pos"/>
        <xsl:apply-templates select="$parameter"/><xsl:text> </xsl:text><xsl:apply-templates select="/Statement/Create/ColumnDefinitions/*[$pos]"/>
    </xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter-ref">
		<xsl:param name="parameter-reference"/>

		<xsl:variable name="reference"><xsl:value-of select="$parameter-reference/@ref"/></xsl:variable>
		<xsl:call-template name="print-non-parametric-parameter">
			<xsl:with-param name="parameter" select="/Statement/Parameters/Parameter[@id=$reference]"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter">
		<xsl:param name="parameter"/>

		<xsl:variable name="db-type"><xsl:value-of select="$parameter/@DBTYPE"/></xsl:variable>
		<xsl:variable name="value"><xsl:value-of select="$parameter/text()"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$db-type = 'DBTYPE_BSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_WSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_STR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_BOOL'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS number)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DATE'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS date)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DBTIMESTAMP'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS date)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_CY'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS number)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_VARIANT'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
            <xsl:when test="$db-type = 'DBTYPE_GUID'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_ByteArray'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DECIMAL'"><xsl:value-of select="$value"/></xsl:when>            
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
U<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" xmlns:mssqlcrt="urn:sql-microsoft-com:sqlcrt" xmlns:mssqldbg="urn:sql-microsoft-com:sqldbg">
	<xsl:output method="xml" indent="yes"/>

	<!-- This ALWAYS GENERATED file contains the definitions for the cartridges
	             Microsoft Cartridge Interfaces (Analysis Services 2005)
	             (C) Copyright 1988 - 2003 By Microsoft Corporation.      -->

	<!-- SQL Server 2000 pluggable cartridge                              -->

	<!-- Area of STANDARD parametrizations: these are externally passed   -->
	<xsl:param name="in_CanUseParams">yes</xsl:param>
	<xsl:param name="in_IdentStartQuotingCharacter">[</xsl:param>
	<xsl:param name="in_IdentEndQuotingCharacter">]</xsl:param>
	<xsl:param name="in_StringStartQuotingCharacter">N'</xsl:param>
	<xsl:param name="in_StringEndQuotingCharacter">'</xsl:param>
	
	<!-- Area of CORE parametrizations: These are externally checked      -->
	<mssqlcrt:provider managed="yes" native="yes">Microsoft SQL Server.08.00.0191</mssqlcrt:provider>
	<mssqlcrt:provider managed="yes" native="yes">Microsoft SQL Server.08.00.0194</mssqlcrt:provider>
	<mssqlcrt:provider type="prefix" managed="yes" native="yes">Microsoft SQL Server</mssqlcrt:provider>
	<mssqlcrt:provider type="prefix" managed="yes" native="yes"></mssqlcrt:provider>
  <mssqlcrt:parameter-style native="unnamed" managed="named"/>

	<mssqlcrt:capabilities>
		<mssqlcrt:supports-datepart-year/>
		<mssqlcrt:supports-datepart-quarter/>
		<mssqlcrt:supports-datepart-month/>
		<mssqlcrt:supports-datepart-dayofyear/>
		<mssqlcrt:supports-datepart-day/>
		<mssqlcrt:supports-datepart-week/>
		<mssqlcrt:supports-datepart-dayofweek/>
		<mssqlcrt:supports-datepart-hour/>
		<mssqlcrt:supports-datepart-minute/>
		<mssqlcrt:supports-datepart-second/>
		<mssqlcrt:supports-datepart-millisecond/>
		<mssqlcrt:supports-multiple-distinct-count/>
		<mssqlcrt:supports-update/>
		<mssqlcrt:supports-insert/>
		<mssqlcrt:supports-subselect/>
		<mssqlcrt:supports-table-alias/>
		<mssqlcrt:supports-column-alias/>
		<mssqlcrt:supports-cast/>
		<mssqlcrt:supports-remote-query/>
		<mssqlcrt:supports-top-clause/>
		<mssqlcrt:supports-union/>
		<mssqlcrt:supports-union-all/>
		<mssqlcrt:supports-fast-writeback>TABLOCK,FIRE_TRIGGERS</mssqlcrt:supports-fast-writeback>
		<mssqlcrt:supports-materialized-view>2</mssqlcrt:supports-materialized-view>
		<!-- mssqlcrt:supports-materialized-view-prevalidation -->

		<mssqlcrt:limit-materialized-view-column-count>16</mssqlcrt:limit-materialized-view-column-count>
        <!--
            This cartridge is used as the default cartridge for unknown providers
            So even though SQL supports larger aliases (at least 128), we'll use a smaller
            alias for the other providers
        -->
		<mssqlcrt:limit-table-identifier-length>64</mssqlcrt:limit-table-identifier-length>
		<mssqlcrt:limit-column-identifier-length>64</mssqlcrt:limit-column-identifier-length>

		<!-- Map from MSDAInitialize connection string to SQLOLEDB connection string -->
		<mssqlcrt:remote-connection-string-mappings>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Provider</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property></mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Data Source</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>Server</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Initial Catalog</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>Database</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>User ID</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>UID</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Password</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>PWD</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Integrated Security=SSPI</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>Trusted_Connection=yes</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
		</mssqlcrt:remote-connection-string-mappings>
	</mssqlcrt:capabilities>

	<mssqlcrt:schema-classes>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.SqlClient</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.SqlSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		    <mssqlcrt:query-designer>
			    <mssqlcrt:type>Microsoft.DataWarehouse.Controls.SqlClientQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
		    </mssqlcrt:query-designer>
		</mssqlcrt:schema-class>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.OleDb</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OleDbSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		    <mssqlcrt:query-designer>
			    <mssqlcrt:type>Microsoft.DataWarehouse.Controls.OleDbQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
		    </mssqlcrt:query-designer>
		</mssqlcrt:schema-class>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.Odbc</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OdbcSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		</mssqlcrt:schema-class>
	</mssqlcrt:schema-classes>
	<!-- Area of internal parametrizations                                -->
	<!-- overrideOfUseParams:
	         yes      = use always parametric queries
	         no       = never use parametric queries
			 nosubsel = use as yes, but not on subselects
			 auto     = use the value of in_CanUseParams to determine     -->
	<xsl:variable name="overrideOfUseParams">auto</xsl:variable>
	<!-- shouldProduceDebug:
	         yes      = produce debug information
	         no       = do not produce debug information                  -->
	<xsl:variable name="shouldProduceDebug">yes</xsl:variable>

	<!-- Area of global variables initializations                         -->
	<xsl:variable name="UseParams">
		<xsl:choose>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'yes' or (normalize-space($overrideOfUseParams) = 'auto' and normalize-space($in_CanUseParams)='yes')">yes</xsl:when>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'nosubsel'">nosubsel</xsl:when>
			<xsl:otherwise>no</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="ProduceDebug" select="$shouldProduceDebug"/>
	<xsl:variable name="IdentifierStartQuotingCharacter" select="normalize-space($in_IdentStartQuotingCharacter)"/>
	<xsl:variable name="IdentifierEndQuotingCharacter" select="normalize-space($in_IdentEndQuotingCharacter)"/>
	<xsl:variable name="StringStartQuotingCharacter" select="normalize-space($in_StringStartQuotingCharacter)"/>
	<xsl:variable name="StringEndQuotingCharacter" select="normalize-space($in_StringEndQuotingCharacter)"/>

	<!-- Generated statement packaging                                    -->
	<xsl:template match="/">
		<xsl:element name="Statement">

			<!-- Generate query                                           -->
			<xsl:element name="Text">
				<xsl:apply-templates select="./Statement/*[1]"/>
			</xsl:element>

			<!-- Generate parameters                                      -->
			<xsl:if test="count(./Statement/Parameters/Parameter)!=0 and ((normalize-space($UseParams)='yes') or (normalize-space($UseParams)='nosubsel'))">
				<xsl:element name="Parameters">
					<xsl:choose>
						<xsl:when test="/Statement/*[1]//Parameter/@ParamName">
							<xsl:for-each select="./Statement/Parameters/Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@id"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:for-each select="./Statement/*[1]//Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@ref"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
			</xsl:if>

			<!-- Generate debug info                                      -->
			<xsl:if test="$ProduceDebug='yes'">
				<xsl:element name="mssqldbg:DebugInfo">
					<xsl:element name="mssqldbg:GenerateParametricInfo">
						<xsl:attribute name="mssqldbg:Value">
							<xsl:value-of select="$UseParams"/>
						</xsl:attribute>
						<xsl:element name="mssqldbg:External">
							<xsl:value-of select="$in_CanUseParams"/>
						</xsl:element>
						<xsl:element name="mssqldbg:Internal">
							<xsl:value-of select="$overrideOfUseParams"/>
						</xsl:element>
					</xsl:element>
				</xsl:element>
			</xsl:if>

		</xsl:element>
	</xsl:template>

	<!-- Union statement                                                  -->
	<xsl:template match="Union">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Union All statement                                                  -->
	<xsl:template match="UnionAll">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION ALL '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Top clause                                                       -->
	<xsl:template match="Top">
		TOP <xsl:value-of select="."/><xsl:text> </xsl:text>
	</xsl:template>

	<!-- Select statement                                                 -->
	<xsl:template match="Select">
		<xsl:choose>
			<xsl:when test="count(./ColumnExpressions/IsValidForIndexing) != 0">
				SELECT OBJECTPROPERTY( object_id('<xsl:apply-templates select="./Sources/View"/>'), 'isindexable' )
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
					(
				</xsl:if>
				SELECT <xsl:apply-templates select="./Top"/>
					<xsl:apply-templates select="./Distinct"/>
					<xsl:apply-templates select="./ColumnExpressions"/>
					<xsl:if test="count(../Phase) != 0">, COUNT_BIG(*) AS [COUNT_BIG_7673aff6-2445-4ef6-a4c9-7bf3d93bd42a] </xsl:if>
					<xsl:apply-templates select="./Sources"/>
					<xsl:apply-templates select="./Where"/>
					<xsl:apply-templates select="./GroupBy"/>
					<xsl:apply-templates select="./Having"/>
					<xsl:apply-templates select="./OrderBy"/>
				<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
					)
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Update statement                                                 -->
	<xsl:template match="Update">
		UPDATE <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Insert statement                                                 -->
	<xsl:template match="Insert">
		INSERT INTO <xsl:apply-templates select="./Target"/>
		<xsl:apply-templates select="./Select"/>
	</xsl:template>

	<!-- Delete statement                                                 -->
	<xsl:template match="Delete">
		DELETE FROM <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Drop statement                                                   -->
	<xsl:template match="Drop">
		DROP <xsl:apply-templates select="./*"/>
	</xsl:template>

	<!-- Create statement                                                 -->
	<xsl:template match="Create">
		CREATE 
		<xsl:variable name="phase"><xsl:value-of select="./Phase"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="number($phase)=1">
				VIEW <xsl:apply-templates select="./View"/> ( <xsl:apply-templates select="./*[4]"/>, [COUNT_BIG_7673aff6-2445-4ef6-a4c9-7bf3d93bd42a] ) WITH SCHEMABINDING AS <xsl:apply-templates select="./*[5]"/>
			</xsl:when>
			<xsl:when test="number($phase)=2">
				UNIQUE CLUSTERED INDEX <xsl:apply-templates select="./Index"/> ON <xsl:apply-templates select="./View"/> ( <xsl:apply-templates select="./*[4]"/> )
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select="./*[1]"/>
				<xsl:choose>
					<xsl:when test="name(./*[1]) = 'Table'"> ( <xsl:apply-templates select="./*[2]"/> )</xsl:when>
				</xsl:choose>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Remote query (OPENROWSET)                                        -->
	<xsl:template match="RemoteQuery">
		OPENROWSET
		(
			<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./Provider"/></xsl:call-template>,
			<xsl:choose>
				<xsl:when test="./DataSource">
					<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./DataSource"/></xsl:call-template>;<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./UserName"/></xsl:call-template>;<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./Password"/></xsl:call-template>,
				</xsl:when>
				<xsl:otherwise>
					<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./ConnectionString"/></xsl:call-template>,
				</xsl:otherwise>
			</xsl:choose>
			<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./*[last()]"/></xsl:call-template>
		)
	</xsl:template>

	<xsl:template match="Distinct">
		DISTINCT
	</xsl:template>

	<xsl:template match="As">
		<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Sources">
		FROM <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnDefinitions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="GroupBy">
		GROUP BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="OrderBy">
		ORDER BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Where">
		WHERE <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="Having">
		HAVING <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="ColumnExpressions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnUpdates">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Assign">
		<xsl:apply-templates select="./*[1]"/>=<xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Insert/Target">
		<xsl:apply-templates select="./Table"/>
		(
			<xsl:call-template name="print-list">
				<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[1]"/>
			</xsl:call-template>
		)
		<xsl:if test="./*[2]/Assign">
			VALUES
			(
				<xsl:call-template name="print-list">
					<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[2]"/>
				</xsl:call-template>
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="Update/Target">
		<xsl:apply-templates select="./Table"/>
		SET <xsl:apply-templates select="./ColumnUpdates"/>
	</xsl:template>

	<xsl:template match="Delete/Target">
		<xsl:apply-templates select="./Table"/>
	</xsl:template>

	<xsl:template match="Insert/Target/ColumnUpdates/Assign/SQLColumn[1]">
		<!-- The table name is not printed for LHS of assignments in insert -->
		<xsl:apply-templates select="./Column"/>
	</xsl:template>

	<xsl:template match="Create/ColumnDefinitions/SQLColumn">
		<xsl:apply-templates select="./Column"/>
		<xsl:if test="count(../../Phase) = 0">
			<xsl:apply-templates select="./Type"/>
			<xsl:apply-templates select="./Usage"/>
		</xsl:if>
	</xsl:template>

	<xsl:template match="SQLColumn">
		<xsl:variable name="table">
			<xsl:if test="name(..)!='Count' or name(./Column/*[1]) != 'Asterisk'"><xsl:apply-templates select="./Table"/></xsl:if>
		</xsl:variable>
		<xsl:variable name="column">
			<xsl:apply-templates select="./Column"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$table = ''">
				<xsl:value-of select="$column"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($table,'.', $column)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Create/Database|Drop/Database">
		DATABASE <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Create/Table|Drop/Table">
		TABLE <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="View">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Drop/View">
		VIEW <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Index">
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Drop/Index">
		INDEX <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Column">
		<xsl:apply-templates select="./Asterisk"/>
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table/Name|View/Name|Index/Name|Column/Name|Database/Name|Schema">
		<xsl:call-template name="quote-identifier"/>
	</xsl:template>

	<xsl:template match="Usage">
		<xsl:variable name="usage"><xsl:value-of select="."/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$usage = 'Key'">    primary key   </xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="OpaqueExpression">
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			(
		</xsl:if>
		<xsl:value-of select="."/>
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="OrderExpression">
		<xsl:apply-templates select="./*[1]"/>
		<xsl:apply-templates select="./Asc"/>
		<xsl:apply-templates select="./Desc"/>
	</xsl:template>

	<xsl:template match="Asc">
		ASC
	</xsl:template>

	<xsl:template match="Desc">
		DESC
	</xsl:template>

	<!-- Print values: ? for parametric queries and convert expressions
	     for non-parametric queries                                       -->
	<xsl:template match="Parameter">
		<xsl:choose>
			<xsl:when test="$UseParams = 'yes' or $UseParams = 'nosubsel'">
				<xsl:choose>
					<xsl:when test="./@ParamName">
						@<xsl:value-of select="./@ParamName"/>
					</xsl:when>
					<xsl:otherwise>
						?
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="print-non-parametric-parameter-ref">
					<xsl:with-param name="parameter-reference" select="."/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- DatePart                                                         -->
	<xsl:template match="DatePart">
		DATEPART( <xsl:apply-templates select="./*[1]"/> , <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- DatePartSpec                                                     -->
	<xsl:template match="DatePartSpec">
		<xsl:variable name="dps-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$dps-val = 'Year'">        year        </xsl:when>
			<xsl:when test="$dps-val = 'Quarter'">     quarter     </xsl:when>
			<xsl:when test="$dps-val = 'Month'">       month       </xsl:when>
			<xsl:when test="$dps-val = 'DayOfYear'">   dayofyear   </xsl:when>
			<xsl:when test="$dps-val = 'Day'">         day         </xsl:when>
			<xsl:when test="$dps-val = 'Week'">        week        </xsl:when>
			<xsl:when test="$dps-val = 'DayOfWeek'">   weekday     </xsl:when>
			<xsl:when test="$dps-val = 'Hour'">        hour        </xsl:when>
			<xsl:when test="$dps-val = 'Minute'">      minute      </xsl:when>
			<xsl:when test="$dps-val = 'Second'">      second      </xsl:when>
			<xsl:when test="$dps-val = 'Millisecond'"> millisecond </xsl:when>
		</xsl:choose>
	</xsl:template>

	<!-- Asterisk                                                         -->
	<xsl:template match="Asterisk">*</xsl:template>

	<!-- Count/Min/Max/Sum                                                -->
	<xsl:template match="Min|Max|Sum">
		<xsl:variable name="function">
			<xsl:choose>
				<xsl:when test="name()='Min'"> MIN </xsl:when>
				<xsl:when test="name()='Max'"> MAX </xsl:when>
				<xsl:when test="name()='Sum'"> SUM </xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$function"/>( <xsl:apply-templates select="./*[1]"/> )
	</xsl:template>

	<xsl:template match="Count">
		COUNT_BIG ( <xsl:apply-templates select="./*[1]"/> <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- Binary expressions                                               -->
	<!-- Equal/NotEqual/Greater/GreaterOrEqual/Less/LessOrEqual/In/And/Or/Plus/Minus/Divide/Multiply
	     expressions                                                      -->
	<xsl:template match="Equal|NotEqual|Greater|GreaterOrEqual|Less|LessOrEqual|In|And|Or|Plus|Minus|Divide|Multiply">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='Equal'">			=		</xsl:when>
				<xsl:when test="name()='NotEqual'">			&lt;&gt;	</xsl:when>
				<xsl:when test="name()='Greater'">			&gt;		</xsl:when>
				<xsl:when test="name()='GreaterOrEqual'">	&gt;=		</xsl:when>
				<xsl:when test="name()='Less'">				&lt;	</xsl:when>
				<xsl:when test="name()='LessOrEqual'">		&lt;=	</xsl:when>
				<xsl:when test="name()='In'">				IN		</xsl:when>
				<xsl:when test="name()='And'">				AND		</xsl:when>
				<xsl:when test="name()='Or'">				OR		</xsl:when>
				<xsl:when test="name()='Plus'">				+		</xsl:when>
				<xsl:when test="name()='Minus'">			-		</xsl:when>
				<xsl:when test="name()='Divide'">			/		</xsl:when>
				<xsl:when test="name()='Multiply'">			*		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="$operator"/>
			</xsl:call-template>
		)
	</xsl:template>

	<!-- Postfix unary expressions                                        -->
	<!-- IsNull
	     expressions                                                      -->
	<xsl:template match="IsNull">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='IsNull'">			IS NULL		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:apply-templates select="./*[1]"/>
			<xsl:value-of select="$operator"/>
		)
	</xsl:template>

	<!-- Types                                                            -->
	<xsl:template match="Type">
		<xsl:variable name="type-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$type-val = 'DBTYPE_BSTR'">    nvarchar     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_WSTR'">    nvarchar     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_STR'">     varchar      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_BOOL'">    bit          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I1'">      tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I2'">      smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I4'">      int          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I8'">      bigint       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI1'">     tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI2'">     smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI4'">     int          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI8'">     bigint       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R4'">      real         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R8'">      float        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DATE'">    datetime     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DBTIMESTAMP'">    datetime     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_CY'">      money        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_VARIANT'"> sql_variant  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_GUID'"> uniqueidentifier  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_ByteArray'"> varbinary  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DECIMAL'"> decimal      </xsl:when>
		</xsl:choose>
		<xsl:apply-templates select="./Size"/>
		<xsl:apply-templates select="./Precision"/>
		<xsl:apply-templates select="./Scale"/>		
	</xsl:template>

	<!-- Size (optional)                                                  -->
	<xsl:template match="Size">
	( <xsl:value-of select="./text()"/> )
	</xsl:template>
	
	<!-- Precision (optional)                                                  -->
	<xsl:template match="Precision">
	( <xsl:value-of select="./text()"/>
	</xsl:template>

	<!-- Scale (optional)                                                  -->
	<xsl:template match="Scale">
	, <xsl:value-of select="./text()"/> )
	</xsl:template>
	<!-- Cast                                                             -->
	<xsl:template match="Cast">
		CAST(<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>)
	</xsl:template>
	
	<!-- By default don't do anything                                     -->
	<xsl:template match="*">
	</xsl:template>

	<!-- Print a schema object                                               -->
	<xsl:template name="build-quoted-schema-object"> 
		<xsl:param name="schema-object-node" select="."/>

		<xsl:variable name="schema">
			<xsl:apply-templates select="$schema-object-node/Schema"/>
		</xsl:variable>
		<xsl:variable name="table">
			<xsl:apply-templates select="$schema-object-node/Name"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$schema = ''">
				<xsl:value-of select="$table"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($schema,'.', $table)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Convert an identifier to the OLEDB quotation form                -->
	<xsl:template name="quote-identifier"> 
		<xsl:param name="identifier" select="."/>

		<xsl:value-of select="$IdentifierStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$identifier"/>
			<xsl:with-param name="end-quoting-char" select="$IdentifierEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$IdentifierEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert a string to the string quotation form                    -->
	<xsl:template name="quote-string"> 
		<xsl:param name="string" select="."/>

		<xsl:value-of select="$StringStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$string"/>
			<xsl:with-param name="end-quoting-char" select="$StringEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$StringEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert an entity to the quotation form (recursive, aux)  by
         duplicating the end quoting character                            -->
	<xsl:template name="normalize-entity-aux"> 
		<xsl:param name="entity"/>
		<xsl:param name="end-quoting-char"/>

		<xsl:choose>
			<xsl:when test="contains($entity, $end-quoting-char)">
				<xsl:value-of select="substring-before($entity, $end-quoting-char)"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:call-template name="normalize-entity-aux">
					<xsl:with-param name="entity" select="substring-after($entity, $end-quoting-char)"/>
					<xsl:with-param name="end-quoting-char" select="$end-quoting-char"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$entity"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Print the children list                                          -->
	<xsl:template name="print-children-list">
		<xsl:param name="operator" select="','"/>
		
		<xsl:call-template name="print-list">
			<xsl:with-param name="value-node" select="./*"/>
			<xsl:with-param name="operator" select="$operator"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Print a list                                                     -->
	<xsl:template name="print-list">
		<xsl:param name="operator" select="','"/>
		<xsl:param name="value-node" select="."/>

		<xsl:for-each select="$value-node">
			<xsl:apply-templates select="."/>
			<xsl:if test="position()!=last()">
				<xsl:value-of select="$operator"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter-ref">
		<xsl:param name="parameter-reference"/>

		<xsl:variable name="reference"><xsl:value-of select="$parameter-reference/@ref"/></xsl:variable>
		<xsl:call-template name="print-non-parametric-parameter">
			<xsl:with-param name="parameter" select="/Statement/Parameters/Parameter[@id=$reference]"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter">
		<xsl:param name="parameter"/>

		<xsl:variable name="db-type"><xsl:value-of select="$parameter/@DBTYPE"/></xsl:variable>
		<xsl:variable name="value"><xsl:value-of select="$parameter/text()"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$db-type = 'DBTYPE_BSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_WSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_STR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_BOOL'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS bit)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DATE'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS datetime)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DBTIMESTAMP'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS datetime)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_CY'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS money)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_VARIANT'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
            <xsl:when test="$db-type = 'DBTYPE_GUID'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_ByteArray'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DECIMAL'"><xsl:value-of select="$value"/></xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
{<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" xmlns:mssqlcrt="urn:sql-microsoft-com:sqlcrt" xmlns:mssqldbg="urn:sql-microsoft-com:sqldbg">
	<xsl:output method="xml" indent="yes"/>

	<!-- This ALWAYS GENERATED file contains the definitions for the cartridges
	             Microsoft Cartridge Interfaces (Analysis Services 2005)
	             (C) Copyright 1988 - 2003 By Microsoft Corporation.      -->

	<!-- SQL Server 7.0 pluggable cartridge                              -->

	<!-- Area of STANDARD parametrizations: these are externally passed   -->
	<xsl:param name="in_CanUseParams">yes</xsl:param>
	<xsl:param name="in_IdentStartQuotingCharacter">[</xsl:param>
	<xsl:param name="in_IdentEndQuotingCharacter">]</xsl:param>
	<xsl:param name="in_StringStartQuotingCharacter">'</xsl:param>
	<xsl:param name="in_StringEndQuotingCharacter">'</xsl:param>
	
	<!-- Area of CORE parametrizations: These are externally checked      -->
	<mssqlcrt:provider type="prefix" managed="yes" native="yes">Microsoft SQL Server.07</mssqlcrt:provider>
  <mssqlcrt:parameter-style native="unnamed" managed="named"/>

	<mssqlcrt:capabilities>
		<mssqlcrt:supports-datepart-year/>
		<mssqlcrt:supports-datepart-quarter/>
		<mssqlcrt:supports-datepart-month/>
		<mssqlcrt:supports-datepart-dayofyear/>
		<mssqlcrt:supports-datepart-day/>
		<mssqlcrt:supports-datepart-week/>
		<mssqlcrt:supports-datepart-dayofweek/>
		<mssqlcrt:supports-datepart-hour/>
		<mssqlcrt:supports-datepart-minute/>
		<mssqlcrt:supports-datepart-second/>
		<mssqlcrt:supports-datepart-millisecond/>
		<mssqlcrt:supports-multiple-distinct-count/>
		<mssqlcrt:supports-update/>
		<mssqlcrt:supports-insert/>
		<mssqlcrt:supports-subselect/>
		<mssqlcrt:supports-table-alias/>
		<mssqlcrt:supports-column-alias/>
		<mssqlcrt:supports-cast/>
		<mssqlcrt:supports-remote-query/>
		<mssqlcrt:supports-top-clause/>
		<mssqlcrt:supports-union/>
		<mssqlcrt:supports-union-all/>
		<mssqlcrt:supports-fast-writeback>TABLOCK,FIRE_TRIGGERS</mssqlcrt:supports-fast-writeback>
		<mssqlcrt:limit-table-identifier-length>128</mssqlcrt:limit-table-identifier-length>
		<mssqlcrt:limit-column-identifier-length>128</mssqlcrt:limit-column-identifier-length>

		<!-- Map from MSDAInitialize connection string to SQLOLEDB connection string -->
		<mssqlcrt:remote-connection-string-mappings>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Provider</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property></mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Data Source</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>Server</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Initial Catalog</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>Database</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>User ID</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>UID</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Password</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>PWD</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
			<mssqlcrt:remote-connection-string-mapping>
				<mssqlcrt:datasource-property>Integrated Security=SSPI</mssqlcrt:datasource-property>
				<mssqlcrt:remote-property>Trusted_Connection=yes</mssqlcrt:remote-property>
			</mssqlcrt:remote-connection-string-mapping>
		</mssqlcrt:remote-connection-string-mappings>
	</mssqlcrt:capabilities>

	<mssqlcrt:schema-classes>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.SqlClient</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.SqlSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		    <mssqlcrt:query-designer>
			    <mssqlcrt:type>Microsoft.DataWarehouse.Controls.SqlClientQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
		    </mssqlcrt:query-designer>
		</mssqlcrt:schema-class>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.OleDb</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OleDbSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		    <mssqlcrt:query-designer>
			    <mssqlcrt:type>Microsoft.DataWarehouse.Controls.OleDbQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
		    </mssqlcrt:query-designer>
		</mssqlcrt:schema-class>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.Odbc</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OdbcSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		</mssqlcrt:schema-class>
	</mssqlcrt:schema-classes>
	<!-- Area of internal parametrizations                                -->
	<!-- overrideOfUseParams:
	         yes      = use always parametric queries
	         no       = never use parametric queries
			 nosubsel = use as yes, but not on subselects
			 auto     = use the value of in_CanUseParams to determine     -->
	<xsl:variable name="overrideOfUseParams">auto</xsl:variable>
	<!-- shouldProduceDebug:
	         yes      = produce debug information
	         no       = do not produce debug information                  -->
	<xsl:variable name="shouldProduceDebug">yes</xsl:variable>

	<!-- Area of global variables initializations                         -->
	<xsl:variable name="UseParams">
		<xsl:choose>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'yes' or (normalize-space($overrideOfUseParams) = 'auto' and normalize-space($in_CanUseParams)='yes')">yes</xsl:when>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'nosubsel'">nosubsel</xsl:when>
			<xsl:otherwise>no</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="ProduceDebug" select="$shouldProduceDebug"/>
	<xsl:variable name="IdentifierStartQuotingCharacter" select="normalize-space($in_IdentStartQuotingCharacter)"/>
	<xsl:variable name="IdentifierEndQuotingCharacter" select="normalize-space($in_IdentEndQuotingCharacter)"/>
	<xsl:variable name="StringStartQuotingCharacter" select="normalize-space($in_StringStartQuotingCharacter)"/>
	<xsl:variable name="StringEndQuotingCharacter" select="normalize-space($in_StringEndQuotingCharacter)"/>

	<!-- Generated statement packaging                                    -->
	<xsl:template match="/">
		<xsl:element name="Statement">

			<!-- Generate query                                           -->
			<xsl:element name="Text">
				<xsl:apply-templates select="./Statement/*[1]"/>
			</xsl:element>

			<!-- Generate parameters                                      -->
			<xsl:if test="count(./Statement/Parameters/Parameter)!=0 and ((normalize-space($UseParams)='yes') or (normalize-space($UseParams)='nosubsel'))">
				<xsl:element name="Parameters">
					<xsl:choose>
						<xsl:when test="/Statement/*[1]//Parameter/@ParamName">
							<xsl:for-each select="./Statement/Parameters/Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@id"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:for-each select="./Statement/*[1]//Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@ref"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
			</xsl:if>

			<!-- Generate debug info                                      -->
			<xsl:if test="$ProduceDebug='yes'">
				<xsl:element name="mssqldbg:DebugInfo">
					<xsl:element name="mssqldbg:GenerateParametricInfo">
						<xsl:attribute name="mssqldbg:Value">
							<xsl:value-of select="$UseParams"/>
						</xsl:attribute>
						<xsl:element name="mssqldbg:External">
							<xsl:value-of select="$in_CanUseParams"/>
						</xsl:element>
						<xsl:element name="mssqldbg:Internal">
							<xsl:value-of select="$overrideOfUseParams"/>
						</xsl:element>
					</xsl:element>
				</xsl:element>
			</xsl:if>

		</xsl:element>
	</xsl:template>

	<!-- Union statement                                                  -->
	<xsl:template match="Union">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Union All statement                                                  -->
	<xsl:template match="UnionAll">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION ALL '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Top clause                                                       -->
	<xsl:template match="Top">
		TOP <xsl:value-of select="."/><xsl:text> </xsl:text>
	</xsl:template>

	<!-- Select statement                                                 -->
	<xsl:template match="Select">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
			(
		</xsl:if>
		SELECT <xsl:apply-templates select="./Top"/>
			<xsl:apply-templates select="./Distinct"/>
			<xsl:apply-templates select="./ColumnExpressions"/>
			<xsl:apply-templates select="./Sources"/>
			<xsl:apply-templates select="./Where"/>
			<xsl:apply-templates select="./GroupBy"/>
			<xsl:apply-templates select="./OrderBy"/>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Union' and name(..) != 'UnionAll'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Update statement                                                 -->
	<xsl:template match="Update">
		UPDATE <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Insert statement                                                 -->
	<xsl:template match="Insert">
		INSERT INTO <xsl:apply-templates select="./Target"/>
		<xsl:apply-templates select="./Select"/>
	</xsl:template>

	<!-- Delete statement                                                 -->
	<xsl:template match="Delete">
		DELETE FROM <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Drop statement                                                   -->
	<xsl:template match="Drop">
		DROP <xsl:apply-templates select="./*"/>
	</xsl:template>

	<!-- Create statement                                                 -->
	<xsl:template match="Create">
		CREATE <xsl:apply-templates select="./*[1]"/>
		<xsl:choose>
			<xsl:when test="name(./*[1]) = 'Table'">( <xsl:apply-templates select="./*[2]"/> )</xsl:when>
		</xsl:choose>
	</xsl:template>

	<!-- Remote query (OPENROWSET)                                        -->
	<xsl:template match="RemoteQuery">
		OPENROWSET
		(
			<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./Provider"/></xsl:call-template>,
			<xsl:choose>
				<xsl:when test="./DataSource">
					<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./DataSource"/></xsl:call-template>;<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./UserName"/></xsl:call-template>;<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./Password"/></xsl:call-template>,
				</xsl:when>
				<xsl:otherwise>
					<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./ConnectionString"/></xsl:call-template>,
				</xsl:otherwise>
			</xsl:choose>
			<xsl:call-template name="quote-string"><xsl:with-param name="string" select="./*[last()]"/></xsl:call-template>
		)
	</xsl:template>

	<xsl:template match="Distinct">
		DISTINCT
	</xsl:template>

	<xsl:template match="As">
		<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Sources">
		FROM <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnDefinitions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="GroupBy">
		GROUP BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="OrderBy">
		ORDER BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Where">
		WHERE <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="Having">
		HAVING <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="ColumnExpressions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnUpdates">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Assign">
		<xsl:apply-templates select="./*[1]"/>=<xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Insert/Target">
		<xsl:apply-templates select="./Table"/>
		(
			<xsl:call-template name="print-list">
				<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[1]"/>
			</xsl:call-template>
		)
		<xsl:if test="./*[2]/Assign">
			VALUES
			(
				<xsl:call-template name="print-list">
					<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[2]"/>
				</xsl:call-template>
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="Update/Target">
		<xsl:apply-templates select="./Table"/>
		SET <xsl:apply-templates select="./ColumnUpdates"/>
	</xsl:template>

	<xsl:template match="Delete/Target">
		<xsl:apply-templates select="./Table"/>
	</xsl:template>

	<xsl:template match="Insert/Target/ColumnUpdates/Assign/SQLColumn[1]">
		<!-- The table name is not printed for LHS of assignments in insert -->
		<xsl:apply-templates select="./Column"/>
	</xsl:template>

	<xsl:template match="Create/ColumnDefinitions/SQLColumn">
		<xsl:apply-templates select="./Column"/>
		<xsl:apply-templates select="./Type"/>
		<xsl:apply-templates select="./Usage"/>
	</xsl:template>

	<xsl:template match="SQLColumn">
		<xsl:variable name="table">
			<xsl:if test="name(..)!='Count' or name(./Column/*[1]) != 'Asterisk'"><xsl:apply-templates select="./Table"/></xsl:if>
		</xsl:variable>
		<xsl:variable name="column">
			<xsl:apply-templates select="./Column"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$table = ''">
				<xsl:value-of select="$column"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($table,'.', $column)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Create/Database|Drop/Database">
		DATABASE <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Create/Table|Drop/Table">
		TABLE <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="View">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Drop/View">
		VIEW <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Index">
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Drop/Index">
		INDEX <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Column">
		<xsl:apply-templates select="./Asterisk"/>
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table/Name|View/Name|Index/Name|Column/Name|Database/Name|Schema">
		<xsl:call-template name="quote-identifier"/>
	</xsl:template>

	<xsl:template match="Usage">
		<xsl:variable name="usage"><xsl:value-of select="."/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$usage = 'Key'">    primary key   </xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="OpaqueExpression">
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			(
		</xsl:if>
		<xsl:value-of select="."/>
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="OrderExpression">
		<xsl:apply-templates select="./*[1]"/>
		<xsl:apply-templates select="./Asc"/>
		<xsl:apply-templates select="./Desc"/>
	</xsl:template>

	<xsl:template match="Asc">
		ASC
	</xsl:template>

	<xsl:template match="Desc">
		DESC
	</xsl:template>

	<!-- Print values: ? for parametric queries and convert expressions
	     for non-parametric queries                                       -->
	<xsl:template match="Parameter">
		<xsl:choose>
			<xsl:when test="$UseParams = 'yes' or $UseParams = 'nosubsel'">
				<xsl:choose>
					<xsl:when test="./@ParamName">
						@<xsl:value-of select="./@ParamName"/>
					</xsl:when>
					<xsl:otherwise>
						?
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="print-non-parametric-parameter-ref">
					<xsl:with-param name="parameter-reference" select="."/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- DatePart                                                         -->
	<xsl:template match="DatePart">
		DATEPART( <xsl:apply-templates select="./*[1]"/> , <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- DatePartSpec                                                     -->
	<xsl:template match="DatePartSpec">
		<xsl:variable name="dps-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$dps-val = 'Year'">        year        </xsl:when>
			<xsl:when test="$dps-val = 'Quarter'">     quarter     </xsl:when>
			<xsl:when test="$dps-val = 'Month'">       month       </xsl:when>
			<xsl:when test="$dps-val = 'DayOfYear'">   dayofyear   </xsl:when>
			<xsl:when test="$dps-val = 'Day'">         day         </xsl:when>
			<xsl:when test="$dps-val = 'Week'">        week        </xsl:when>
			<xsl:when test="$dps-val = 'DayOfWeek'">   weekday     </xsl:when>
			<xsl:when test="$dps-val = 'Hour'">        hour        </xsl:when>
			<xsl:when test="$dps-val = 'Minute'">      minute      </xsl:when>
			<xsl:when test="$dps-val = 'Second'">      second      </xsl:when>
			<xsl:when test="$dps-val = 'Millisecond'"> millisecond </xsl:when>
		</xsl:choose>
	</xsl:template>

	<!-- Asterisk                                                         -->
	<xsl:template match="Asterisk">*</xsl:template>

	<!-- Count/Min/Max/Sum                                                -->
	<xsl:template match="Min|Max|Sum">
		<xsl:variable name="function">
			<xsl:choose>
				<xsl:when test="name()='Min'"> MIN </xsl:when>
				<xsl:when test="name()='Max'"> MAX </xsl:when>
				<xsl:when test="name()='Sum'"> SUM </xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$function"/>( <xsl:apply-templates select="./*[1]"/> )
	</xsl:template>

	<xsl:template match="Count">
		COUNT ( <xsl:apply-templates select="./*[1]"/> <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- Binary expressions                                               -->
	<!-- Equal/NotEqual/Greater/GreaterOrEqual/Less/LessOrEqual/In/And/Or/Plus/Minus/Divide/Multiply
	     expressions                                                      -->
	<xsl:template match="Equal|NotEqual|Greater|GreaterOrEqual|Less|LessOrEqual|In|And|Or|Plus|Minus|Divide|Multiply">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='Equal'">			=		</xsl:when>
				<xsl:when test="name()='NotEqual'">			&lt;&gt;	</xsl:when>
				<xsl:when test="name()='Greater'">			&gt;		</xsl:when>
				<xsl:when test="name()='GreaterOrEqual'">	&gt;=		</xsl:when>
				<xsl:when test="name()='Less'">				&lt;	</xsl:when>
				<xsl:when test="name()='LessOrEqual'">		&lt;=	</xsl:when>
				<xsl:when test="name()='In'">				IN		</xsl:when>
				<xsl:when test="name()='And'">				AND		</xsl:when>
				<xsl:when test="name()='Or'">				OR		</xsl:when>
				<xsl:when test="name()='Plus'">				+		</xsl:when>
				<xsl:when test="name()='Minus'">			-		</xsl:when>
				<xsl:when test="name()='Divide'">			/		</xsl:when>
				<xsl:when test="name()='Multiply'">			*		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="$operator"/>
			</xsl:call-template>
		)
	</xsl:template>

	<!-- Postfix unary expressions                                        -->
	<!-- IsNull
	     expressions                                                      -->
	<xsl:template match="IsNull">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='IsNull'">			IS NULL		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:apply-templates select="./*[1]"/>
			<xsl:value-of select="$operator"/>
		)
	</xsl:template>

	<!-- Types                                                            -->
	<xsl:template match="Type">
		<xsl:variable name="type-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$type-val = 'DBTYPE_BSTR'">    nvarchar     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_WSTR'">    nvarchar     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_STR'">     varchar      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_BOOL'">    bit          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I1'">      tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I2'">      smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I4'">      int          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I8'">      bigint       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI1'">     tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI2'">     smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI4'">     int          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI8'">     bigint       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R4'">      real         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R8'">      float        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DATE'">    datetime     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DBTIMESTAMP'">    datetime     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_CY'">      money        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_VARIANT'"> sql_variant  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_GUID'"> uniqueidentifier  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_ByteArray'"> varbinary  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DECIMAL'"> decimal      </xsl:when>
		</xsl:choose>
		<xsl:apply-templates select="./Size"/>
		<xsl:apply-templates select="./Precision"/>
		<xsl:apply-templates select="./Scale"/>		
	</xsl:template>

	<!-- Size (optional)                                                  -->
	<xsl:template match="Size">
	( <xsl:value-of select="./text()"/> )
	</xsl:template>
	
	<!-- Precision (optional)                                                  -->
	<xsl:template match="Precision">
	( <xsl:value-of select="./text()"/>
	</xsl:template>

	<!-- Scale (optional)                                                  -->
	<xsl:template match="Scale">
	, <xsl:value-of select="./text()"/> )
	</xsl:template>
	<!-- Cast                                                             -->
	<xsl:template match="Cast">
		CAST(<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>)
	</xsl:template>
	
	<!-- By default don't do anything                                     -->
	<xsl:template match="*">
	</xsl:template>

	<!-- Print a schema object                                               -->
	<xsl:template name="build-quoted-schema-object"> 
		<xsl:param name="schema-object-node" select="."/>

		<xsl:variable name="schema">
			<xsl:apply-templates select="$schema-object-node/Schema"/>
		</xsl:variable>
		<xsl:variable name="table">
			<xsl:apply-templates select="$schema-object-node/Name"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$schema = ''">
				<xsl:value-of select="$table"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($schema,'.', $table)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Convert an identifier to the OLEDB quotation form                -->
	<xsl:template name="quote-identifier"> 
		<xsl:param name="identifier" select="."/>

		<xsl:value-of select="$IdentifierStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$identifier"/>
			<xsl:with-param name="end-quoting-char" select="$IdentifierEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$IdentifierEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert a string to the string quotation form                    -->
	<xsl:template name="quote-string"> 
		<xsl:param name="string" select="."/>

		<xsl:value-of select="$StringStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$string"/>
			<xsl:with-param name="end-quoting-char" select="$StringEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$StringEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert an entity to the quotation form (recursive, aux)  by
         duplicating the end quoting character                            -->
	<xsl:template name="normalize-entity-aux"> 
		<xsl:param name="entity"/>
		<xsl:param name="end-quoting-char"/>

		<xsl:choose>
			<xsl:when test="contains($entity, $end-quoting-char)">
				<xsl:value-of select="substring-before($entity, $end-quoting-char)"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:call-template name="normalize-entity-aux">
					<xsl:with-param name="entity" select="substring-after($entity, $end-quoting-char)"/>
					<xsl:with-param name="end-quoting-char" select="$end-quoting-char"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$entity"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Print the children list                                          -->
	<xsl:template name="print-children-list">
		<xsl:param name="operator" select="','"/>
		
		<xsl:call-template name="print-list">
			<xsl:with-param name="value-node" select="./*"/>
			<xsl:with-param name="operator" select="$operator"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Print a list                                                     -->
	<xsl:template name="print-list">
		<xsl:param name="operator" select="','"/>
		<xsl:param name="value-node" select="."/>

		<xsl:for-each select="$value-node">
			<xsl:apply-templates select="."/>
			<xsl:if test="position()!=last()">
				<xsl:value-of select="$operator"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter-ref">
		<xsl:param name="parameter-reference"/>

		<xsl:variable name="reference"><xsl:value-of select="$parameter-reference/@ref"/></xsl:variable>
		<xsl:call-template name="print-non-parametric-parameter">
			<xsl:with-param name="parameter" select="/Statement/Parameters/Parameter[@id=$reference]"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter">
		<xsl:param name="parameter"/>

		<xsl:variable name="db-type"><xsl:value-of select="$parameter/@DBTYPE"/></xsl:variable>
		<xsl:variable name="value"><xsl:value-of select="$parameter/text()"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$db-type = 'DBTYPE_BSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_WSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_STR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_BOOL'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS bit)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DATE'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS datetime)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DBTIMESTAMP'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS datetime)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_CY'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS money)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_VARIANT'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
            <xsl:when test="$db-type = 'DBTYPE_GUID'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_ByteArray'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DECIMAL'"><xsl:value-of select="$value"/></xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
"i<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" xmlns:mssqlcrt="urn:sql-microsoft-com:sqlcrt" xmlns:mssqldbg="urn:sql-microsoft-com:sqldbg">
	<xsl:output method="xml" indent="yes"/>

	<!-- This ALWAYS GENERATED file contains the definitions for the cartridges
	             Microsoft Cartridge Interfaces (Analysis Services 2005)
	             (C) Copyright 1988 - 2003 By Microsoft Corporation.      -->

	<!-- Teradata V2R41 pluggable cartridge                               -->

	<!-- Area of STANDARD parametrizations: these are externally passed   -->
	<xsl:param name="in_CanUseParams">yes</xsl:param>
	<xsl:param name="in_IdentStartQuotingCharacter">"</xsl:param>
	<xsl:param name="in_IdentEndQuotingCharacter">"</xsl:param>
	<xsl:param name="in_StringStartQuotingCharacter">'</xsl:param>
	<xsl:param name="in_StringEndQuotingCharacter">'</xsl:param>

	<!-- Area of CORE parametrizations: These are externally checked      -->
	<mssqlcrt:provider type="prefix" managed="yes" native="yes">Teradata</mssqlcrt:provider>
  <mssqlcrt:parameter-style native="unnamed" managed="unnamed"/>

	<mssqlcrt:capabilities>
		<mssqlcrt:supports-data-sampling/>
		<mssqlcrt:supports-update/>
		<mssqlcrt:supports-insert/>
		<mssqlcrt:supports-subselect/>
		<mssqlcrt:supports-table-alias/>
		<mssqlcrt:supports-column-alias/>
		<mssqlcrt:supports-union/>
		<mssqlcrt:supports-union-all/>
		<mssqlcrt:limit-table-identifier-length>30</mssqlcrt:limit-table-identifier-length>
		<mssqlcrt:limit-column-identifier-length>30</mssqlcrt:limit-column-identifier-length>
	</mssqlcrt:capabilities>

	<mssqlcrt:schema-classes>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.OleDb</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OleDbSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		    <mssqlcrt:query-designer>
			    <mssqlcrt:type>Microsoft.DataWarehouse.Controls.OleDbQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
		    </mssqlcrt:query-designer>
		</mssqlcrt:schema-class>
		<mssqlcrt:schema-class>
		    <mssqlcrt:managed-provider>System.Data.Odbc</mssqlcrt:managed-provider>
		    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OdbcSchema, Microsoft.DataWarehouse</mssqlcrt:type>
		</mssqlcrt:schema-class>
	</mssqlcrt:schema-classes>

	<!-- Area of internal parametrizations                                -->
	<!-- overrideOfUseParams:
	         yes      = use always parametric queries
	         no       = never use parametric queries
			 nosubsel = use as yes, but not on subselects
			 auto     = use the value of in_CanUseParams to determine     -->
	<xsl:variable name="overrideOfUseParams">auto</xsl:variable>
	<!-- shouldProduceDebug:
	         yes      = produce debug information
	         no       = do not produce debug information                  -->
	<xsl:variable name="shouldProduceDebug">yes</xsl:variable>

	<!-- Area of global variables initializations                         -->
	<xsl:variable name="UseParams">
		<xsl:choose>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'yes' or (normalize-space($overrideOfUseParams) = 'auto' and normalize-space($in_CanUseParams)='yes')">yes</xsl:when>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'nosubsel'">nosubsel</xsl:when>
			<xsl:otherwise>no</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="ProduceDebug" select="$shouldProduceDebug"/>
	<xsl:variable name="IdentifierStartQuotingCharacter" select="normalize-space($in_IdentStartQuotingCharacter)"/>
	<xsl:variable name="IdentifierEndQuotingCharacter" select="normalize-space($in_IdentEndQuotingCharacter)"/>
	<xsl:variable name="StringStartQuotingCharacter" select="normalize-space($in_StringStartQuotingCharacter)"/>
	<xsl:variable name="StringEndQuotingCharacter" select="normalize-space($in_StringEndQuotingCharacter)"/>

	<!-- Generated statement packaging                                    -->
	<xsl:template match="/">
		<xsl:element name="Statement">

			<!-- Generate query                                           -->
			<xsl:element name="Text">
				<xsl:apply-templates select="./Statement/*[1]"/>
			</xsl:element>

			<!-- Generate parameters                                      -->
			<xsl:if test="count(./Statement/Parameters/Parameter)!=0 and ((normalize-space($UseParams)='yes') or (normalize-space($UseParams)='nosubsel'))">
				<xsl:element name="Parameters">
					<xsl:choose>
						<xsl:when test="/Statement/*[1]//Parameter/@ParamName">
							<xsl:for-each select="./Statement/Parameters/Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@id"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:for-each select="./Statement/*[1]//Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@ref"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
			</xsl:if>

			<!-- Generate debug info                                      -->
			<xsl:if test="$ProduceDebug='yes'">
				<xsl:element name="mssqldbg:DebugInfo">
					<xsl:element name="mssqldbg:GenerateParametricInfo">
						<xsl:attribute name="mssqldbg:Value">
							<xsl:value-of select="$UseParams"/>
						</xsl:attribute>
						<xsl:element name="mssqldbg:External">
							<xsl:value-of select="$in_CanUseParams"/>
						</xsl:element>
						<xsl:element name="mssqldbg:Internal">
							<xsl:value-of select="$overrideOfUseParams"/>
						</xsl:element>
					</xsl:element>
				</xsl:element>
			</xsl:if>

		</xsl:element>
	</xsl:template>

	<!-- Union statement                                                  -->
	<xsl:template match="Union">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Union All statement                                                  -->
	<xsl:template match="UnionAll">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION ALL '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Sample statement                                                 -->
	<xsl:template match="Sample">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
		(
		</xsl:if>
			<xsl:apply-templates select="./*[1]"/>
			SAMPLE <xsl:apply-templates select="./*[2]"/>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
		)
		</xsl:if>
	</xsl:template>

	<!-- Max Row Count clause                                             -->
	<xsl:template match="MaxRowCount">
		<xsl:value-of select="."/>
	</xsl:template>

	<!-- Select statement                                                 -->
	<xsl:template match="Select">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Sample' and name(..) != 'Union' and name(..) != 'UnionAll'">
			(
		</xsl:if>
		SELECT <xsl:apply-templates select="./Distinct"/>
			<xsl:apply-templates select="./ColumnExpressions"/>
			<xsl:apply-templates select="./Sources"/>
			<xsl:apply-templates select="./Where"/>
			<xsl:apply-templates select="./GroupBy"/>
			<xsl:apply-templates select="./OrderBy"/>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Sample' and name(..) != 'Union' and name(..) != 'UnionAll'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Update statement                                                 -->
	<xsl:template match="Update">
		UPDATE <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Insert statement                                                 -->
	<xsl:template match="Insert">
		INSERT INTO <xsl:apply-templates select="./Target"/>
		<xsl:apply-templates select="./Select"/>
	</xsl:template>

	<!-- Delete statement                                                 -->
	<xsl:template match="Delete">
		DELETE FROM <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Drop statement                                                   -->
	<xsl:template match="Drop">
		DROP <xsl:apply-templates select="./*"/>
	</xsl:template>

	<!-- Create statement                                                 -->
	<xsl:template match="Create">
		CREATE <xsl:apply-templates select="./*[1]"/>
		<xsl:choose>
			<xsl:when test="name(./*[1]) = 'Table'">( <xsl:apply-templates select="./*[2]"/> )</xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Distinct">
		DISTINCT
	</xsl:template>

	<xsl:template match="As">
		<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Sources">
		FROM <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnDefinitions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="GroupBy">
		GROUP BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="OrderBy">
		ORDER BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Where">
		WHERE <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="Having">
		HAVING <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="ColumnExpressions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnUpdates">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Assign">
		<xsl:apply-templates select="./*[1]"/>=<xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Insert/Target">
		<xsl:apply-templates select="./Table"/>
		(
			<xsl:call-template name="print-list">
				<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[1]"/>
			</xsl:call-template>
		)
		<xsl:if test="./*[2]/Assign">
			VALUES
			(
				<xsl:call-template name="print-list">
					<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[2]"/>
				</xsl:call-template>
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="Update/Target">
		<xsl:apply-templates select="./Table"/>
		SET <xsl:apply-templates select="./ColumnUpdates"/>
	</xsl:template>

	<xsl:template match="Delete/Target">
		<xsl:apply-templates select="./Table"/>
	</xsl:template>

	<xsl:template match="Insert/Target/ColumnUpdates/Assign/SQLColumn[1]|Update/Target/ColumnUpdates/Assign/SQLColumn[1]">
		<!-- The table name is not printed for LHS of assignments in insert -->
		<xsl:apply-templates select="./Column"/>
	</xsl:template>

	<xsl:template match="Create/ColumnDefinitions/SQLColumn">
		<xsl:apply-templates select="./Column"/>
		<xsl:apply-templates select="./Type"/>
		<xsl:apply-templates select="./Usage"/>
	</xsl:template>

	<xsl:template match="SQLColumn">
		<xsl:variable name="table">
			<xsl:if test="name(..)!='Count' or name(./Column/*[1]) != 'Asterisk'"><xsl:apply-templates select="./Table"/></xsl:if>
		</xsl:variable>
		<xsl:variable name="column">
			<xsl:apply-templates select="./Column"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$table = ''">
				<xsl:value-of select="$column"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($table,'.', $column)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Create/Database|Drop/Database">
		DATABASE <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Create/Table|Drop/Table">
		TABLE <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="View">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Drop/View">
		VIEW <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Index">
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Drop/Index">
		INDEX <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Column">
		<xsl:apply-templates select="./Asterisk"/>
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table/Name|View/Name|Index/Name|Column/Name|Database/Name|Schema">
		<xsl:call-template name="quote-identifier"/>
	</xsl:template>

	<xsl:template match="Usage">
		<xsl:variable name="usage"><xsl:value-of select="."/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$usage = 'Key'">    primary key   </xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="OpaqueExpression">
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			(
		</xsl:if>
		<xsl:value-of select="."/>
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="OrderExpression">
		<xsl:apply-templates select="./*[1]"/>
		<xsl:apply-templates select="./Asc"/>
		<xsl:apply-templates select="./Desc"/>
	</xsl:template>

	<xsl:template match="Asc">
		ASC
	</xsl:template>

	<xsl:template match="Desc">
		DESC
	</xsl:template>

	<!-- Print values: ? for parametric queries and convert expressions
	     for non-parametric queries                                       -->
	<xsl:template match="Parameter">
		<xsl:choose>
			<xsl:when test="$UseParams = 'yes' or $UseParams = 'nosubsel'">
				<xsl:choose>
					<xsl:when test="./@ParamName">
						@<xsl:value-of select="./@ParamName"/>
					</xsl:when>
					<xsl:otherwise>
						?
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="print-non-parametric-parameter-ref">
					<xsl:with-param name="parameter-reference" select="."/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Asterisk                                                         -->
	<xsl:template match="Asterisk">*</xsl:template>

	<!-- Count/Min/Max/Sum                                                -->
	<xsl:template match="Min|Max|Sum">
		<xsl:variable name="function">
			<xsl:choose>
				<xsl:when test="name()='Min'"> MIN </xsl:when>
				<xsl:when test="name()='Max'"> MAX </xsl:when>
				<xsl:when test="name()='Sum'"> SUM </xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$function"/>( <xsl:apply-templates select="./*[1]"/> )
	</xsl:template>

	<xsl:template match="Count">
		COUNT ( <xsl:apply-templates select="./*[1]"/> <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- Binary expressions                                               -->
	<!-- Equal/NotEqual/Greater/GreaterOrEqual/Less/LessOrEqual/In/And/Or/Plus/Minus/Divide/Multiply
	     expressions                                                      -->
	<xsl:template match="Equal|NotEqual|Greater|GreaterOrEqual|Less|LessOrEqual|In|And|Or|Plus|Minus|Divide|Multiply">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='Equal'">			=		</xsl:when>
				<xsl:when test="name()='NotEqual'">			&lt;&gt;	</xsl:when>
				<xsl:when test="name()='Greater'">			&gt;		</xsl:when>
				<xsl:when test="name()='GreaterOrEqual'">	&gt;=		</xsl:when>
				<xsl:when test="name()='Less'">				&lt;	</xsl:when>
				<xsl:when test="name()='LessOrEqual'">		&lt;=	</xsl:when>
				<xsl:when test="name()='In'">				IN		</xsl:when>
				<xsl:when test="name()='And'">				AND		</xsl:when>
				<xsl:when test="name()='Or'">				OR		</xsl:when>
				<xsl:when test="name()='Plus'">				+		</xsl:when>
				<xsl:when test="name()='Minus'">			-		</xsl:when>
				<xsl:when test="name()='Divide'">			/		</xsl:when>
				<xsl:when test="name()='Multiply'">			*		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="$operator"/>
			</xsl:call-template>
		)
	</xsl:template>

	<!-- Postfix unary expressions                                        -->
	<!-- IsNull
	     expressions                                                      -->
	<xsl:template match="IsNull">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='IsNull'">			IS NULL		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:apply-templates select="./*[1]"/>
			<xsl:value-of select="$operator"/>
		)
	</xsl:template>

	<!-- Types                                                            -->
	<xsl:template match="Type">
		<xsl:variable name="type-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$type-val = 'DBTYPE_BSTR'">    varchar     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_WSTR'">    varchar     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_STR'">     varchar      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_BOOL'">    bit      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I1'">      tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I2'">      smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I4'">      int      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I8'">      bigint       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI1'">     tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI2'">     smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI4'">     int      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI8'">     bigint       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R4'">      real         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R8'">      float        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DATE'">    timestamp(2) </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DBTIMESTAMP'">    timestamp(2)     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_CY'">      money        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_VARIANT'"> sql_variant  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_GUID'"> varchar  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_ByteArray'"> varbyte  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DECIMAL'"> decimal      </xsl:when>
		</xsl:choose>
		<xsl:apply-templates select="./Size"/>
		<xsl:apply-templates select="./Precision"/>
		<xsl:apply-templates select="./Scale"/>
	</xsl:template>

	<!-- Size (optional)                                                  -->
	<xsl:template match="Size">
	( <xsl:value-of select="./text()"/> )
	</xsl:template>
	
	<!-- Precision (optional)                                                  -->
	<xsl:template match="Precision">
	( <xsl:value-of select="./text()"/>
	</xsl:template>

	<!-- Scale (optional)                                                  -->
	<xsl:template match="Scale">
	, <xsl:value-of select="./text()"/> )
	</xsl:template>	
	<!-- By default don't do anything                                     -->
	<xsl:template match="*">
	</xsl:template>

	<!-- Print a schema object                                               -->
	<xsl:template name="build-quoted-schema-object"> 
		<xsl:param name="schema-object-node" select="."/>

		<xsl:variable name="schema">
			<xsl:apply-templates select="$schema-object-node/Schema"/>
		</xsl:variable>
		<xsl:variable name="table">
			<xsl:apply-templates select="$schema-object-node/Name"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$schema = ''">
				<xsl:value-of select="$table"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($schema,'.', $table)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Convert an identifier to the OLEDB quotation form                -->
	<xsl:template name="quote-identifier"> 
		<xsl:param name="identifier" select="."/>

		<xsl:value-of select="$IdentifierStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$identifier"/>
			<xsl:with-param name="end-quoting-char" select="$IdentifierEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$IdentifierEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert a string to the string quotation form                    -->
	<xsl:template name="quote-string"> 
		<xsl:param name="string" select="."/>

		<xsl:value-of select="$StringStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$string"/>
			<xsl:with-param name="end-quoting-char" select="$StringEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$StringEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert an entity to the quotation form (recursive, aux)  by
         duplicating the end quoting character                            -->
	<xsl:template name="normalize-entity-aux"> 
		<xsl:param name="entity"/>
		<xsl:param name="end-quoting-char"/>

		<xsl:choose>
			<xsl:when test="contains($entity, $end-quoting-char)">
				<xsl:value-of select="substring-before($entity, $end-quoting-char)"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:call-template name="normalize-entity-aux">
					<xsl:with-param name="entity" select="substring-after($entity, $end-quoting-char)"/>
					<xsl:with-param name="end-quoting-char" select="$end-quoting-char"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$entity"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Print the children list                                          -->
	<xsl:template name="print-children-list">
		<xsl:param name="operator" select="','"/>
		
		<xsl:call-template name="print-list">
			<xsl:with-param name="value-node" select="./*"/>
			<xsl:with-param name="operator" select="$operator"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Print a list                                                     -->
	<xsl:template name="print-list">
		<xsl:param name="operator" select="','"/>
		<xsl:param name="value-node" select="."/>

		<xsl:for-each select="$value-node">
			<xsl:apply-templates select="."/>
			<xsl:if test="position()!=last()">
				<xsl:value-of select="$operator"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter-ref">
		<xsl:param name="parameter-reference"/>

		<xsl:variable name="reference"><xsl:value-of select="$parameter-reference/@ref"/></xsl:variable>
		<xsl:call-template name="print-non-parametric-parameter">
			<xsl:with-param name="parameter" select="/Statement/Parameters/Parameter[@id=$reference]"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter">
		<xsl:param name="parameter"/>

		<xsl:variable name="db-type"><xsl:value-of select="$parameter/@DBTYPE"/></xsl:variable>
		<xsl:variable name="value"><xsl:value-of select="$parameter/text()"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$db-type = 'DBTYPE_BSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_WSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_STR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_BOOL'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS bit)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DATE'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS timestamp(2))</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DBTIMESTAMP'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS timestamp(2))</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_CY'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS money)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_VARIANT'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
            <xsl:when test="$db-type = 'DBTYPE_GUID'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_ByteArray'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DECIMAL'"><xsl:value-of select="$value"/></xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
x<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" xmlns:mssqlcrt="urn:sql-microsoft-com:sqlcrt" xmlns:mssqldbg="urn:sql-microsoft-com:sqldbg">
	<xsl:output method="xml" indent="yes"/>

	<!-- This ALWAYS GENERATED file contains the definitions for the cartridges
	             Microsoft Cartridge Interfaces (Analysis Services 2005)
	             (C) Copyright 1988 - 2003 By Microsoft Corporation.      -->
<!-- Informix Dynamic Server 10 pluggable cartridge				-->


<!-- Area of STANDARD parametrizations: These may be passed in externally.	-->
<xsl:param name="in_CanUseParams">yes</xsl:param>
<xsl:param name="in_IdentStartQuotingCharacter">"</xsl:param>
<xsl:param name="in_IdentEndQuotingCharacter">"</xsl:param>
<xsl:param name="in_StringStartQuotingCharacter">'</xsl:param>
<xsl:param name="in_StringEndQuotingCharacter">'</xsl:param>


<!-- Area of CORE parametrizations: These are externally checked.	-->

<!-- Provider Names 							-->
<mssqlcrt:provider type="prefix" managed="no" native="yes">IBM INFORMIX-Dynamic Server</mssqlcrt:provider>
<mssqlcrt:parameter-style native="unnamed"/>

<!-- Capabilities 							-->
<mssqlcrt:capabilities>
<!-- Supported Capabilities 						-->
    <mssqlcrt:supports-datepart-year/>
    <mssqlcrt:supports-datepart-month/>
    <mssqlcrt:supports-datepart-day/>
    <mssqlcrt:supports-datepart-dayofweek/>
    <mssqlcrt:supports-update/>
    <mssqlcrt:supports-insert/>
    <mssqlcrt:supports-subselect/>
    <mssqlcrt:supports-table-alias/>
    <mssqlcrt:supports-column-alias/>
    <mssqlcrt:supports-cast/>
    <mssqlcrt:supports-union/>
    <mssqlcrt:supports-union-all/>
    <mssqlcrt:supports-join/>

<!-- Unsupported capabilities 					-->
    <!-- mssqlcrt:supports-datepart-quarter 		-->
    <!-- mssqlcrt:supports-datepart-dayofyear 		-->
    <!-- mssqlcrt:supports-datepart-week 		-->
    <!-- mssqlcrt:supports-datepart-hour 		-->
    <!-- mssqlcrt:supports-datepart-minute 		-->
    <!-- mssqlcrt:supports-datepart-second 		-->
    <!-- mssqlcrt:supports-datepart-millisecond 	-->
    <!-- mssqlcrt:supports-multiple-distinct-count	-->
    <!-- mssqlcrt:supports-isolated-transaction-in-snapshot-mode 						-->
    <!-- mssqlcrt:supports-data-sampling: 	IDS does not support data sampling 				-->
    <!-- mssqlcrt:supports-remote-query:  	IDS does not have support for an OPENROWSET-style construct 	-->
    <!-- mssqlcrt:supports-top-clause:    	FIRST cannot be used in subqueries in IDS 			-->
    <!-- mssqlcrt:supports-recursive-select-subquery: 	IDS does not support common table expressions 		-->
    <!-- mssqlcrt:supports-recursive-select: 		IDS does not support common table expressions 		-->
    <!-- mssqlcrt:supports-fast-writeback:		Informix OLE DB does not support IRowsetFastLoad 	-->
    <!-- mssqlcrt:supports-materialized-view: 		IDS does not support materialized views 		-->
    <!-- mssqlcrt:supports-materialized-view-prevalidation: IDS does not support materialized views 		-->

<!-- Limits 								-->
    <mssqlcrt:limit-database-identifier-length>42</mssqlcrt:limit-database-identifier-length>
    <mssqlcrt:limit-table-identifier-length>42</mssqlcrt:limit-table-identifier-length>
    <mssqlcrt:limit-column-identifier-length>42</mssqlcrt:limit-column-identifier-length>

    <!-- Connection throttling is not necessary 								-->
    <!-- mssqlcrt:limit-max-connections-count>10</mssqlcrt:limit-max-connections-count -->

    <!-- Materialized views are not supported 									-->
    <mssqlcrt:limit-materialized-view-column-count>-1</mssqlcrt:limit-materialized-view-column-count>

    <!-- Remote queries are not supported, so no remote connection string mapping behavior is indicated 	-->

</mssqlcrt:capabilities>

<!-- Types								-->
<mssqlcrt:schema-classes>
  <!-- IDS 10 includes an ADO client, but not an implementation of IDbSchema, so it isn't included here	-->
  <mssqlcrt:schema-class>
    <mssqlcrt:managed-provider>System.Data.OleDb</mssqlcrt:managed-provider>
    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OleDbSchema, Microsoft.DataWarehouse</mssqlcrt:type>
    <mssqlcrt:query-designer>
      <mssqlcrt:type>Microsoft.DataWarehouse.Controls.OleDbQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
    </mssqlcrt:query-designer>
  </mssqlcrt:schema-class>
  <mssqlcrt:schema-class>
    <mssqlcrt:managed-provider>System.Data.Odbc</mssqlcrt:managed-provider>
    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OdbcSchema, Microsoft.DataWarehouse</mssqlcrt:type>
  </mssqlcrt:schema-class>
</mssqlcrt:schema-classes>
	<!-- Area of internal parametrizations                                -->
	<!-- overrideOfUseParams:
	         yes      = use always parametric queries
	         no       = never use parametric queries
			 nosubsel = use as yes, but not on subselects
			 auto     = use the value of in_CanUseParams to determine     -->
	<xsl:variable name="overrideOfUseParams">auto</xsl:variable>
	<!-- shouldProduceDebug:
	         yes      = produce debug information
	         no       = do not produce debug information                  -->
	<xsl:variable name="shouldProduceDebug">yes</xsl:variable>

	<!-- Area of global variables initializations                         -->
	<xsl:variable name="UseParams">
		<xsl:choose>
		<!-- Informix OLE DB does not support named parameters -->
		<xsl:when test="/Statement/*[1]//Parameter/@ParamName">no</xsl:when>
		<xsl:otherwise>
			<xsl:choose>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'yes' or (normalize-space($overrideOfUseParams) = 'auto' and normalize-space($in_CanUseParams)='yes')">yes</xsl:when>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'nosubsel'">nosubsel</xsl:when>
			<xsl:otherwise>no</xsl:otherwise>
			</xsl:choose>
		</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="ProduceDebug" select="$shouldProduceDebug"/>
	<xsl:variable name="IdentifierStartQuotingCharacter" select="normalize-space($in_IdentStartQuotingCharacter)"/>
	<xsl:variable name="IdentifierEndQuotingCharacter" select="normalize-space($in_IdentEndQuotingCharacter)"/>
	<xsl:variable name="StringStartQuotingCharacter" select="normalize-space($in_StringStartQuotingCharacter)"/>
	<xsl:variable name="StringEndQuotingCharacter" select="normalize-space($in_StringEndQuotingCharacter)"/>

	<!-- Generated statement packaging                                    -->
	<xsl:template match="/">
		<xsl:element name="Statement">

			<!-- Generate query                                           -->
			<xsl:element name="Text">
				<xsl:apply-templates select="./Statement/*[1]"/>
			</xsl:element>

			<!-- Generate parameters                                      -->
			<xsl:if test="count(./Statement/Parameters/Parameter)!=0 and ((normalize-space($UseParams)='yes') or (normalize-space($UseParams)='nosubsel'))">
				<xsl:element name="Parameters">
					<xsl:choose>
						<xsl:when test="/Statement/*[1]//Parameter/@ParamName">
							<xsl:for-each select="./Statement/Parameters/Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@id"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:for-each select="./Statement/*[1]//Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@ref"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
			</xsl:if>

			<!-- Generate debug info                                      -->
			<xsl:if test="$ProduceDebug='yes'">
				<xsl:element name="mssqldbg:DebugInfo">
					<xsl:element name="mssqldbg:GenerateParametricInfo">
						<xsl:attribute name="mssqldbg:Value">
							<xsl:value-of select="$UseParams"/>
						</xsl:attribute>
						<xsl:element name="mssqldbg:External">
							<xsl:value-of select="$in_CanUseParams"/>
						</xsl:element>
						<xsl:element name="mssqldbg:Internal">
							<xsl:value-of select="$overrideOfUseParams"/>
						</xsl:element>
					</xsl:element>
				</xsl:element>
			</xsl:if>

		</xsl:element>
	</xsl:template>

	<!-- Union statement                                                  -->
	<xsl:template match="Union">
		<xsl:variable name="selectAncestor">
			<xsl:choose>
				<xsl:when test="ancestor::Select">1</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="$selectAncestor != 0">TABLE ( MULTISET (</xsl:when>	
			<xsl:when test="name(..) != 'Statement' and name(..) != 'Insert'">(</xsl:when>
		</xsl:choose>

		<xsl:call-template name="print-children-list">
			<xsl:with-param name="operator" select="' UNION '"/>
		</xsl:call-template>

		<xsl:choose>
			<xsl:when test="$selectAncestor != 0">) )</xsl:when>	
			<xsl:when test="name(..) != 'Statement' and name(..) != 'Insert'">)</xsl:when>
		</xsl:choose>
	</xsl:template>

	<!-- Union All statement                                                  -->
	<xsl:template match="UnionAll">
		<xsl:variable name="selectAncestor">
			<xsl:choose>
				<xsl:when test="ancestor::Select">1</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="$selectAncestor != 0">TABLE ( MULTISET (</xsl:when>	
			<xsl:when test="name(..) != 'Statement' and name(..) != 'Insert'">(</xsl:when>
		</xsl:choose>

		<xsl:call-template name="print-children-list">
			<xsl:with-param name="operator" select="' UNION ALL '"/>
		</xsl:call-template>

		<xsl:choose>
			<xsl:when test="$selectAncestor != 0">) )</xsl:when>	
			<xsl:when test="name(..) != 'Statement' and name(..) != 'Insert'">)</xsl:when>
		</xsl:choose>
	</xsl:template>

	<!-- Select statement                                                 -->
	<xsl:template match="Select">
		<xsl:variable name="selectAncestor">
			<xsl:choose>
				<xsl:when test="ancestor::Select">1</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="$selectAncestor != 0">TABLE ( MULTISET (</xsl:when>	
			<xsl:when test="name(..) != 'Statement' and name(..) != 'Insert'">(</xsl:when>
		</xsl:choose>

		SELECT <xsl:apply-templates select="./Distinct"/>
			<xsl:apply-templates select="./ColumnExpressions"/>
			<xsl:apply-templates select="./Sources"/>
			<xsl:apply-templates select="./Where"/>
			<xsl:apply-templates select="./GroupBy"/>
			<xsl:apply-templates select="./Having"/>
			<xsl:apply-templates select="./OrderBy"/>

		<xsl:choose>
			<xsl:when test="$selectAncestor != 0">) )</xsl:when>	
			<xsl:when test="name(..) != 'Statement' and name(..) != 'Insert'">)</xsl:when>
		</xsl:choose>
	</xsl:template>
	<!-- Update statement                                                 -->
	<xsl:template match="Update">
		UPDATE <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Insert statement                                                 -->
	<xsl:template match="Insert">
		INSERT INTO <xsl:apply-templates select="./Target"/>
		<xsl:apply-templates select="./Select"/>
	</xsl:template>

	<!-- Delete statement                                                 -->
	<xsl:template match="Delete">
		DELETE FROM <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Drop statement                                                   -->
	<xsl:template match="Drop">
		DROP <xsl:apply-templates select="./*"/>
	</xsl:template>

	<!-- Create statement                                                 -->
	<xsl:template match="Create">
		CREATE <xsl:apply-templates select="./*[1]"/>
		<xsl:choose>
			<xsl:when test="name(./*[1]) = 'Table'">( <xsl:apply-templates select="./*[2]"/> )</xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Distinct">
		DISTINCT
	</xsl:template>

	<xsl:template match="As">
		<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Sources">
		FROM <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnDefinitions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="GroupBy">
		GROUP BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="OrderBy">
		ORDER BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Where">
		WHERE <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="Having">
		HAVING <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="ColumnExpressions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnUpdates">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Assign">
		<xsl:apply-templates select="./*[1]"/>=<xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Insert/Target">
		<xsl:apply-templates select="./Table"/>
		(
			<xsl:call-template name="print-list">
				<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[1]"/>
			</xsl:call-template>
		)
		<xsl:if test="./*[2]/Assign">
			VALUES
			(
				<xsl:call-template name="print-list">
					<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[2]"/>
				</xsl:call-template>
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="Update/Target">
		<xsl:apply-templates select="./Table"/>
		SET <xsl:apply-templates select="./ColumnUpdates"/>
	</xsl:template>

	<xsl:template match="Delete/Target">
		<xsl:apply-templates select="./Table"/>
	</xsl:template>

	<xsl:template match="Create/ColumnDefinitions/SQLColumn">
		<xsl:apply-templates select="./Column"/>
		<xsl:apply-templates select="./Type"/>
		<xsl:apply-templates select="./Usage"/>
	</xsl:template>

	<xsl:template match="SQLColumn">
		<xsl:variable name="table">
			<xsl:if test="name(..)!='Count' or name(./Column/*[1]) != 'Asterisk'"><xsl:apply-templates select="./Table"/></xsl:if>
		</xsl:variable>
		<xsl:variable name="column">
			<xsl:apply-templates select="./Column"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$table = ''">
				<xsl:value-of select="$column"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($table,'.', $column)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Create/Database|Drop/Database">
		DATABASE <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Create/Table|Drop/Table">
		TABLE <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="View">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Drop/View">
		VIEW <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Column">
		<xsl:apply-templates select="./Asterisk"/>
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table/Name|View/Name|Index/Name|Column/Name|Database/Name|Schema">
		<xsl:call-template name="quote-identifier"/>
	</xsl:template>

	<xsl:template match="Usage">
		<xsl:variable name="usage"><xsl:value-of select="."/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$usage = 'Key'">    primary key   </xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="OpaqueExpression">
		<xsl:variable name="subSelect">
			<xsl:choose>
				<xsl:when test="count(ancestor::Select) != 0 and ( (name(..) = 'As' and name(../..) = 'Sources') or ( name(..) = 'Sources' ) )">1</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="$subSelect != 0">TABLE ( MULTISET (</xsl:when>	
			<xsl:when test="name(..) = 'As' and name(../..) = 'Sources'">(</xsl:when>
		</xsl:choose>

		<xsl:value-of select="."/>

		<xsl:choose>
			<xsl:when test="$subSelect != 0">) )</xsl:when>
			<xsl:when test="name(..) = 'As' and name(../..) = 'Sources'">)</xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="OrderExpression">
		<xsl:apply-templates select="./*[1]"/>
		<xsl:apply-templates select="./Asc"/>
		<xsl:apply-templates select="./Desc"/>
	</xsl:template>

	<xsl:template match="Asc">
		ASC
	</xsl:template>

	<xsl:template match="Desc">
		DESC
	</xsl:template>

	<!-- Print values: ? for parametric queries without any named parameters. Otherwise convert expressions 
	     to generate non-parametric queries                                       -->
	<xsl:template match="Parameter">
		<xsl:choose>
			<xsl:when test="$UseParams = 'yes' or $UseParams = 'nosubsel'">?</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="print-non-parametric-parameter-ref">
					<xsl:with-param name="parameter-reference" select="."/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- DatePart                                                         -->
	<xsl:template match="DatePart">
		<xsl:apply-templates select="./*[1]"/> ( <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- DatePartSpec                                                     -->
	<xsl:template match="DatePartSpec">
		<xsl:variable name="dps-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$dps-val = 'Year'">YEAR</xsl:when>
			<xsl:when test="$dps-val = 'Month'">MONTH</xsl:when>
			<xsl:when test="$dps-val = 'Day'">DAY</xsl:when>
			<xsl:when test="$dps-val = 'DayOfWeek'">WEEKDAY</xsl:when>
		</xsl:choose>
	</xsl:template>

	<!-- Asterisk                                                         -->
	<xsl:template match="Asterisk">*</xsl:template>

	<!-- Count/Min/Max/Sum                                                -->
	<xsl:template match="Min|Max|Sum">
		<xsl:variable name="function">
			<xsl:choose>
				<xsl:when test="name()='Min'"> MIN </xsl:when>
				<xsl:when test="name()='Max'"> MAX </xsl:when>
				<xsl:when test="name()='Sum'"> SUM </xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$function"/>( <xsl:apply-templates select="./*[1]"/> )
	</xsl:template>

	<xsl:template match="Count">
		COUNT ( <xsl:apply-templates select="./*[1]"/> <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- Binary expressions                                               -->
	<!-- Equal/NotEqual/Greater/GreaterOrEqual/Less/LessOrEqual/In/And/Or/Plus/Minus/Divide/Multiply
	     expressions                                                      -->
	<xsl:template match="Equal|NotEqual|Greater|GreaterOrEqual|Less|LessOrEqual|In|And|Or|Plus|Minus|Divide|Multiply">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='Equal'">			=		</xsl:when>
				<xsl:when test="name()='NotEqual'">			&lt;&gt;	</xsl:when>
				<xsl:when test="name()='Greater'">			&gt;		</xsl:when>
				<xsl:when test="name()='GreaterOrEqual'">	&gt;=		</xsl:when>
				<xsl:when test="name()='Less'">				&lt;	</xsl:when>
				<xsl:when test="name()='LessOrEqual'">		&lt;=	</xsl:when>
				<xsl:when test="name()='In'">				IN		</xsl:when>
				<xsl:when test="name()='And'">				AND		</xsl:when>
				<xsl:when test="name()='Or'">				OR		</xsl:when>
				<xsl:when test="name()='Plus'">				+		</xsl:when>
				<xsl:when test="name()='Minus'">			-		</xsl:when>
				<xsl:when test="name()='Divide'">			/		</xsl:when>
				<xsl:when test="name()='Multiply'">			*		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="$operator"/>
			</xsl:call-template>
		)
	</xsl:template>

	<!-- Postfix unary expressions                                        -->
	<!-- IsNull
	     expressions                                                      -->
	<xsl:template match="IsNull">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='IsNull'">			IS NULL		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:apply-templates select="./*[1]"/>
			<xsl:value-of select="$operator"/>
		)
	</xsl:template>

	<!-- Types                                                            -->
	<xsl:template match="Type">
		<xsl:variable name="type-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:variable name="noSize">
			<xsl:choose>
				<xsl:when test="name(..) = 'Cast' and count(./Size) = 0 and count(./Precision) = 0">1</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="$type-val = 'DBTYPE_BSTR'">    nvarchar <xsl:if test="$noSize">( 255 )</xsl:if></xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_WSTR'">    nvarchar <xsl:if test="$noSize">( 255 )</xsl:if></xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_STR'">     varchar  <xsl:if test="$noSize">( 255 )</xsl:if></xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_BOOL'">    boolean      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I1'">      byte         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I2'">      smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I4'">      int          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I8'">      int8         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI1'">     smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI2'">     int          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI4'">     int8         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI8'">     decimal(20)  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R4'">      real         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R8'">      float        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DATE'">       datetime year to fraction(5)    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DBTIMESTAMP'">datetime year to fraction(5)    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_CY'">         money(19,4)  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_VARIANT'">    blob          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_GUID'">       varchar(128)  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_ByteArray'">  blob  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DECIMAL'">    decimal      </xsl:when>
		</xsl:choose>
		<xsl:apply-templates select="./Size"/>
		<xsl:apply-templates select="./Precision"/>
		<xsl:apply-templates select="./Scale"/>		
	</xsl:template>

	<!-- Size (optional)                                                  -->
	<xsl:template match="Size">
	( <xsl:value-of select="./text()"/> )
	</xsl:template>
	
	<!-- Precision (optional)                                                  -->
	<xsl:template match="Precision">
	( <xsl:value-of select="./text()"/>
	</xsl:template>

	<!-- Scale (optional)                                                  -->
	<xsl:template match="Scale">
	, <xsl:value-of select="./text()"/> )
	</xsl:template>
	<!-- Cast                                                             -->
	<xsl:template match="Cast">
		CAST(<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>)
	</xsl:template>
	
	<!-- By default don't do anything                                     -->
	<xsl:template match="*">
	</xsl:template>

	<!-- Print a schema object                                               -->
	<xsl:template name="build-quoted-schema-object"> 
		<xsl:param name="schema-object-node" select="."/>

		<xsl:variable name="schema">
			<xsl:apply-templates select="$schema-object-node/Schema"/>
		</xsl:variable>
		<xsl:variable name="table">
			<xsl:apply-templates select="$schema-object-node/Name"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$schema = ''">
				<xsl:value-of select="$table"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($schema,'.', $table)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Convert an identifier to the OLEDB quotation form                -->
	<xsl:template name="quote-identifier"> 
		<xsl:param name="identifier" select="."/>

		<xsl:value-of select="$IdentifierStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$identifier"/>
			<xsl:with-param name="end-quoting-char" select="$IdentifierEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$IdentifierEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert a string to the string quotation form                    -->
	<xsl:template name="quote-string"> 
		<xsl:param name="string" select="."/>

		<xsl:value-of select="$StringStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$string"/>
			<xsl:with-param name="end-quoting-char" select="$StringEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$StringEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert an entity to the quotation form (recursive, aux)  by
         duplicating the end quoting character                            -->
	<xsl:template name="normalize-entity-aux"> 
		<xsl:param name="entity"/>
		<xsl:param name="end-quoting-char"/>

		<xsl:choose>
			<xsl:when test="contains($entity, $end-quoting-char)">
				<xsl:value-of select="substring-before($entity, $end-quoting-char)"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:call-template name="normalize-entity-aux">
					<xsl:with-param name="entity" select="substring-after($entity, $end-quoting-char)"/>
					<xsl:with-param name="end-quoting-char" select="$end-quoting-char"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$entity"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Print the children list                                          -->
	<xsl:template name="print-children-list">
		<xsl:param name="operator" select="','"/>
		
		<xsl:call-template name="print-list">
			<xsl:with-param name="value-node" select="./*"/>
			<xsl:with-param name="operator" select="$operator"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Print a list                                                     -->
	<xsl:template name="print-list">
		<xsl:param name="operator" select="','"/>
		<xsl:param name="value-node" select="."/>

		<xsl:for-each select="$value-node">
			<xsl:apply-templates select="."/>
			<xsl:if test="position()!=last()">
				<xsl:value-of select="$operator"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter-ref">
		<xsl:param name="parameter-reference"/>

		<xsl:variable name="reference"><xsl:value-of select="$parameter-reference/@ref"/></xsl:variable>
		<xsl:call-template name="print-non-parametric-parameter">
			<xsl:with-param name="parameter" select="/Statement/Parameters/Parameter[@id=$reference]"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter">
		<xsl:param name="parameter"/>

		<xsl:variable name="db-type"><xsl:value-of select="$parameter/@DBTYPE"/></xsl:variable>
		<xsl:variable name="value"><xsl:value-of select="$parameter/text()"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$db-type = 'DBTYPE_BSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_WSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_STR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_BOOL'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS BOOLEAN)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DATE'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS DATETIME YEAR TO FRACTION(5))</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DBTIMESTAMP'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS DATETIME YEAR TO FRACTION(5))</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_CY'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS MONEY(19,4))</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_VARIANT'"><xsl:value-of select="$value"/></xsl:when>
                        <xsl:when test="$db-type = 'DBTYPE_GUID'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_ByteArray'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DECIMAL'"><xsl:value-of select="$value"/></xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
^t<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" xmlns:mssqlcrt="urn:sql-microsoft-com:sqlcrt" xmlns:mssqldbg="urn:sql-microsoft-com:sqldbg">
	<xsl:output method="xml" indent="yes"/>

	<!-- This ALWAYS GENERATED file contains the definitions for the cartridges
	             Microsoft Cartridge Interfaces (Analysis Services 2005)
	             (C) Copyright 1988 - 2003 By Microsoft Corporation.      -->
<!-- Sybase ASE 15 pluggable cartridge					-->


<!-- Area of STANDARD parametrizations: These may be passed in externally.	-->

<xsl:param name="in_CanUseParams">yes</xsl:param>
<xsl:param name="in_IdentStartQuotingCharacter">[</xsl:param>
<xsl:param name="in_IdentEndQuotingCharacter">]</xsl:param>
<xsl:param name="in_StringStartQuotingCharacter">N'</xsl:param>
<xsl:param name="in_StringEndQuotingCharacter">'</xsl:param>


<!-- Area of CORE parametrizations: These are externally checked.	-->

<!-- Provider Names 							-->
<mssqlcrt:provider type="prefix" managed="no" native="yes">SQL Server</mssqlcrt:provider>
<mssqlcrt:provider type="prefix" managed="no" native="yes">ASE Server</mssqlcrt:provider>
<mssqlcrt:parameter-style native="unnamed"/>

<!-- Capabilities 							-->
<mssqlcrt:capabilities>
<!-- Supported Capabilities 						-->
    <mssqlcrt:supports-datepart-year/>
    <mssqlcrt:supports-datepart-quarter/>
    <mssqlcrt:supports-datepart-month/>
    <mssqlcrt:supports-datepart-dayofyear/>
    <mssqlcrt:supports-datepart-day/>
    <mssqlcrt:supports-datepart-week/>
    <mssqlcrt:supports-datepart-dayofweek/>
    <mssqlcrt:supports-datepart-hour/>
    <mssqlcrt:supports-datepart-minute/>
    <mssqlcrt:supports-datepart-second/>
    <mssqlcrt:supports-datepart-millisecond/>

    <mssqlcrt:supports-multiple-distinct-count/>
    <mssqlcrt:supports-update/>
    <mssqlcrt:supports-insert/>
    <mssqlcrt:supports-subselect/>
    <mssqlcrt:supports-table-alias/>
    <mssqlcrt:supports-column-alias/>
    <mssqlcrt:supports-cast/>
    <mssqlcrt:supports-union/>
    <mssqlcrt:supports-union-all/>
    <mssqlcrt:supports-join/>

<!-- Unsupported capabilities 						-->
    <!-- mssqlcrt:supports-isolated-transaction-in-snapshot-mode 						-->
    <!-- mssqlcrt:supports-data-sampling: Sybase ASE does not support data sampling 				-->
    <!-- mssqlcrt:supports-remote-query:  Sybase ASE does not have support for an OPENROWSET-style construct 	-->
    <!-- mssqlcrt:supports-top-clause:    TOP cannot be used in subqueries in Sybase ASE 			-->
    <!-- mssqlcrt:supports-recursive-select-subquery: 	Sybase ASE does not support common table expressions 	-->
    <!-- mssqlcrt:supports-recursive-select: 		Sybase ASE does not support common table expressions 	-->
    <!-- mssqlcrt:supports-fast-writeback:	Sybase ASE OLE DB does not support IRowsetFastLoad 		-->
    <!-- mssqlcrt:supports-materialized-view: 	Sybase ASE does not support indexed views 			-->
    <!-- mssqlcrt:supports-materialized-view-prevalidation: Sybase ASE does not support indexed views 		-->

<!-- Limits 								-->
    <!-- Database identifier: 30 bytes / 3 bytes max per UTF-8 character 					-->
    <mssqlcrt:limit-database-identifier-length>10</mssqlcrt:limit-database-identifier-length>

    <!-- Table and Column identifiers: 255 bytes / 3 bytes max per UTF-8 character 				-->
    <mssqlcrt:limit-table-identifier-length>85</mssqlcrt:limit-table-identifier-length>
    <mssqlcrt:limit-column-identifier-length>85</mssqlcrt:limit-column-identifier-length>

    <!-- Don't throttle connections -->
    <!-- mssqlcrt:limit-max-connections-count>10</mssqlcrt:limit-max-connections-count -->

    <!-- Materialized views are unsupported 									-->
    <mssqlcrt:limit-materialized-view-column-count>-1</mssqlcrt:limit-materialized-view-column-count>

    <!-- Remote queries are unsupported, so remote connection strings are too 					-->

</mssqlcrt:capabilities>

<!-- Types								-->
<mssqlcrt:schema-classes>
  <!-- Sybase ASE 15 includes an ADO client, but not an implementation of IDbSchema, so it isn't included here	-->
  <mssqlcrt:schema-class>
    <mssqlcrt:managed-provider>System.Data.OleDb</mssqlcrt:managed-provider>
    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OleDbSchema, Microsoft.DataWarehouse</mssqlcrt:type>
    <mssqlcrt:query-designer>
      <mssqlcrt:type>Microsoft.DataWarehouse.Controls.OleDbQueryDesigner, Microsoft.DataWarehouse</mssqlcrt:type>
    </mssqlcrt:query-designer>
  </mssqlcrt:schema-class>
  <mssqlcrt:schema-class>
    <mssqlcrt:managed-provider>System.Data.Odbc</mssqlcrt:managed-provider>
    <mssqlcrt:type>Microsoft.DataWarehouse.Design.OdbcSchema, Microsoft.DataWarehouse</mssqlcrt:type>
  </mssqlcrt:schema-class>
</mssqlcrt:schema-classes>
	<!-- Area of internal parametrizations                                -->
	<!-- overrideOfUseParams:
	         yes      = use always parametric queries
	         no       = never use parametric queries
			 nosubsel = use as yes, but not on subselects
			 auto     = use the value of in_CanUseParams to determine     -->
	<xsl:variable name="overrideOfUseParams">auto</xsl:variable>
	<!-- shouldProduceDebug:
	         yes      = produce debug information
	         no       = do not produce debug information                  -->
	<xsl:variable name="shouldProduceDebug">yes</xsl:variable>

	<!-- Area of global variables initializations                         -->
	<xsl:variable name="UseParams">
		<xsl:choose>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'yes' or (normalize-space($overrideOfUseParams) = 'auto' and normalize-space($in_CanUseParams)='yes')">yes</xsl:when>
			<xsl:when test="normalize-space($overrideOfUseParams) = 'nosubsel'">nosubsel</xsl:when>
			<xsl:otherwise>no</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:variable name="ProduceDebug" select="$shouldProduceDebug"/>
	<xsl:variable name="IdentifierStartQuotingCharacter" select="normalize-space($in_IdentStartQuotingCharacter)"/>
	<xsl:variable name="IdentifierEndQuotingCharacter" select="normalize-space($in_IdentEndQuotingCharacter)"/>
	<xsl:variable name="StringStartQuotingCharacter" select="normalize-space($in_StringStartQuotingCharacter)"/>
	<xsl:variable name="StringEndQuotingCharacter" select="normalize-space($in_StringEndQuotingCharacter)"/>

	<!-- Generated statement packaging                                    -->
	<xsl:template match="/">
		<xsl:element name="Statement">

			<!-- Generate query                                           -->
			<xsl:element name="Text">
				<xsl:apply-templates select="./Statement/*[1]"/>
			</xsl:element>

			<!-- Generate parameters                                      -->
			<xsl:if test="count(./Statement/Parameters/Parameter)!=0 and ((normalize-space($UseParams)='yes') or (normalize-space($UseParams)='nosubsel'))">
				<xsl:element name="Parameters">
					<xsl:choose>
						<xsl:when test="/Statement/*[1]//Parameter/@ParamName">
							<xsl:for-each select="./Statement/Parameters/Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@id"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:when>
						<xsl:otherwise>
							<xsl:for-each select="./Statement/*[1]//Parameter">
								<xsl:element name="Parameter">
									<xsl:attribute name="ref">
										<xsl:value-of select="./@ref"/>
									</xsl:attribute>
								</xsl:element>
							</xsl:for-each>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
			</xsl:if>

			<!-- Generate debug info                                      -->
			<xsl:if test="$ProduceDebug='yes'">
				<xsl:element name="mssqldbg:DebugInfo">
					<xsl:element name="mssqldbg:GenerateParametricInfo">
						<xsl:attribute name="mssqldbg:Value">
							<xsl:value-of select="$UseParams"/>
						</xsl:attribute>
						<xsl:element name="mssqldbg:External">
							<xsl:value-of select="$in_CanUseParams"/>
						</xsl:element>
						<xsl:element name="mssqldbg:Internal">
							<xsl:value-of select="$overrideOfUseParams"/>
						</xsl:element>
					</xsl:element>
				</xsl:element>
			</xsl:if>

		</xsl:element>
	</xsl:template>

	<!-- Union statement                                                  -->
	<xsl:template match="Union">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Union All statement                                                  -->
	<xsl:template match="UnionAll">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			(
		</xsl:if>
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="' UNION ALL '"/>
			</xsl:call-template>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert'">
			)
		</xsl:if>
	</xsl:template>

	<!-- Select statement                                                 -->
	<xsl:template match="Select">
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Sample' and name(..) != 'Union' and name(..) != 'UnionAll'">
			(
		</xsl:if>
		SELECT <xsl:apply-templates select="./Distinct"/>
			<xsl:apply-templates select="./ColumnExpressions"/>
			<xsl:apply-templates select="./Sources"/>
			<xsl:apply-templates select="./Where"/>
			<xsl:apply-templates select="./GroupBy"/>
			<xsl:apply-templates select="./Having"/>
			<xsl:apply-templates select="./OrderBy"/>
		<xsl:if test="name(..) != 'Statement' and name(..) != 'Insert' and name(..) != 'Sample' and name(..) != 'Union' and name(..) != 'UnionAll'">
			)
		</xsl:if>
	</xsl:template>
	<!-- Update statement                                                 -->
	<xsl:template match="Update">
		UPDATE <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Insert statement                                                 -->
	<xsl:template match="Insert">
		INSERT INTO <xsl:apply-templates select="./Target"/>
		<xsl:apply-templates select="./Select"/>
	</xsl:template>

	<!-- Delete statement                                                 -->
	<xsl:template match="Delete">
		DELETE FROM <xsl:apply-templates select="./Target"/>
			<xsl:apply-templates select="./Where"/>
	</xsl:template>

	<!-- Drop statement                                                   -->
	<xsl:template match="Drop">
		DROP <xsl:apply-templates select="./*"/>
	</xsl:template>

	<!-- Create statement                                                 -->
	<xsl:template match="Create">
		CREATE <xsl:apply-templates select="./*[1]"/>
		<xsl:choose>
			<xsl:when test="name(./*[1]) = 'Table'">( <xsl:apply-templates select="./*[2]"/> )</xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Distinct">
		DISTINCT
	</xsl:template>

	<xsl:template match="As">
		<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Sources">
		FROM <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnDefinitions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="GroupBy">
		GROUP BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="OrderBy">
		ORDER BY <xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Where">
		WHERE <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="Having">
		HAVING <xsl:apply-templates select="./*"/>
	</xsl:template>

	<xsl:template match="ColumnExpressions">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="ColumnUpdates">
		<xsl:call-template name="print-children-list"/>
	</xsl:template>

	<xsl:template match="Assign">
		<xsl:apply-templates select="./*[1]"/>=<xsl:apply-templates select="./*[2]"/>
	</xsl:template>

	<xsl:template match="Insert/Target">
		<xsl:apply-templates select="./Table"/>
		(
			<xsl:call-template name="print-list">
				<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[1]"/>
			</xsl:call-template>
		)
		<xsl:if test="./*[2]/Assign">
			VALUES
			(
				<xsl:call-template name="print-list">
					<xsl:with-param name="value-node" select="./ColumnUpdates/*/*[2]"/>
				</xsl:call-template>
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="Update/Target">
		<xsl:apply-templates select="./Table"/>
		SET <xsl:apply-templates select="./ColumnUpdates"/>
	</xsl:template>

	<xsl:template match="Delete/Target">
		<xsl:apply-templates select="./Table"/>
	</xsl:template>

	<xsl:template match="Create/ColumnDefinitions/SQLColumn">
		<xsl:apply-templates select="./Column"/>
		<xsl:apply-templates select="./Type"/>
		<xsl:apply-templates select="./Usage"/>
	</xsl:template>

	<xsl:template match="SQLColumn">
		<xsl:variable name="table">
			<xsl:if test="name(..)!='Count' or name(./Column/*[1]) != 'Asterisk'"><xsl:apply-templates select="./Table"/></xsl:if>
		</xsl:variable>
		<xsl:variable name="column">
			<xsl:apply-templates select="./Column"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$table = ''">
				<xsl:value-of select="$column"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($table,'.', $column)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="Create/Database|Drop/Database">
		DATABASE <xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Create/Table|Drop/Table">
		TABLE <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="View">
		<xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Drop/View">
		VIEW <xsl:call-template name="build-quoted-schema-object"/>
	</xsl:template>

	<xsl:template match="Column">
		<xsl:apply-templates select="./Asterisk"/>
		<xsl:apply-templates select="./Name"/>
	</xsl:template>

	<xsl:template match="Table/Name|View/Name|Index/Name|Column/Name|Database/Name|Schema">
		<xsl:call-template name="quote-identifier"/>
	</xsl:template>

	<xsl:template match="Usage">
		<xsl:variable name="usage"><xsl:value-of select="."/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$usage = 'Key'">    primary key   </xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="OpaqueExpression">
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			(
		</xsl:if>
		<xsl:value-of select="."/>
		<xsl:if test="name(..) = 'As' and name(../..) = 'Sources'">
			)
		</xsl:if>
	</xsl:template>

	<xsl:template match="OrderExpression">
		<xsl:apply-templates select="./*[1]"/>
		<xsl:apply-templates select="./Asc"/>
		<xsl:apply-templates select="./Desc"/>
	</xsl:template>

	<xsl:template match="Asc">
		ASC
	</xsl:template>

	<xsl:template match="Desc">
		DESC
	</xsl:template>

	<!-- Print values: ? for parametric queries and convert expressions
	     for non-parametric queries                                       -->
	<xsl:template match="Parameter">
		<xsl:choose>
			<xsl:when test="$UseParams = 'yes' or $UseParams = 'nosubsel'">
				<xsl:choose>
					<xsl:when test="./@ParamName">
						@<xsl:value-of select="./@ParamName"/>
					</xsl:when>
					<xsl:otherwise>
						?
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<xsl:call-template name="print-non-parametric-parameter-ref">
					<xsl:with-param name="parameter-reference" select="."/>
				</xsl:call-template>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- DatePart                                                         -->
	<xsl:template match="DatePart">
		DATEPART( <xsl:apply-templates select="./*[1]"/> , <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- DatePartSpec                                                     -->
	<xsl:template match="DatePartSpec">
		<xsl:variable name="dps-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$dps-val = 'Year'">        year        </xsl:when>
			<xsl:when test="$dps-val = 'Quarter'">     quarter     </xsl:when>
			<xsl:when test="$dps-val = 'Month'">       month       </xsl:when>
			<xsl:when test="$dps-val = 'DayOfYear'">   dayofyear   </xsl:when>
			<xsl:when test="$dps-val = 'Day'">         day         </xsl:when>
			<xsl:when test="$dps-val = 'Week'">        week        </xsl:when>
			<xsl:when test="$dps-val = 'DayOfWeek'">   weekday     </xsl:when>
			<xsl:when test="$dps-val = 'Hour'">        hour        </xsl:when>
			<xsl:when test="$dps-val = 'Minute'">      minute      </xsl:when>
			<xsl:when test="$dps-val = 'Second'">      second      </xsl:when>
			<xsl:when test="$dps-val = 'Millisecond'"> millisecond </xsl:when>
		</xsl:choose>
	</xsl:template>

	<!-- Asterisk                                                         -->
	<xsl:template match="Asterisk">*</xsl:template>

	<!-- Count/Min/Max/Sum                                                -->
	<xsl:template match="Min|Max|Sum">
		<xsl:variable name="function">
			<xsl:choose>
				<xsl:when test="name()='Min'"> MIN </xsl:when>
				<xsl:when test="name()='Max'"> MAX </xsl:when>
				<xsl:when test="name()='Sum'"> SUM </xsl:when>
			</xsl:choose>
		</xsl:variable>
		<xsl:value-of select="$function"/>( <xsl:apply-templates select="./*[1]"/> )
	</xsl:template>

	<xsl:template match="Count">
		COUNT_BIG ( <xsl:apply-templates select="./*[1]"/> <xsl:apply-templates select="./*[2]"/> )
	</xsl:template>

	<!-- Binary expressions                                               -->
	<!-- Equal/NotEqual/Greater/GreaterOrEqual/Less/LessOrEqual/In/And/Or/Plus/Minus/Divide/Multiply
	     expressions                                                      -->
	<xsl:template match="Equal|NotEqual|Greater|GreaterOrEqual|Less|LessOrEqual|In|And|Or|Plus|Minus|Divide|Multiply">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='Equal'">			=		</xsl:when>
				<xsl:when test="name()='NotEqual'">			&lt;&gt;	</xsl:when>
				<xsl:when test="name()='Greater'">			&gt;		</xsl:when>
				<xsl:when test="name()='GreaterOrEqual'">	&gt;=		</xsl:when>
				<xsl:when test="name()='Less'">				&lt;	</xsl:when>
				<xsl:when test="name()='LessOrEqual'">		&lt;=	</xsl:when>
				<xsl:when test="name()='In'">				IN		</xsl:when>
				<xsl:when test="name()='And'">				AND		</xsl:when>
				<xsl:when test="name()='Or'">				OR		</xsl:when>
				<xsl:when test="name()='Plus'">				+		</xsl:when>
				<xsl:when test="name()='Minus'">			-		</xsl:when>
				<xsl:when test="name()='Divide'">			/		</xsl:when>
				<xsl:when test="name()='Multiply'">			*		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:call-template name="print-children-list">
				<xsl:with-param name="operator" select="$operator"/>
			</xsl:call-template>
		)
	</xsl:template>

	<!-- Postfix unary expressions                                        -->
	<!-- IsNull
	     expressions                                                      -->
	<xsl:template match="IsNull">
		<xsl:variable name="operator">
			<xsl:choose>
				<xsl:when test="name()='IsNull'">			IS NULL		</xsl:when>
			</xsl:choose>
		</xsl:variable>
		(
			<xsl:apply-templates select="./*[1]"/>
			<xsl:value-of select="$operator"/>
		)
	</xsl:template>

	<!-- Types                                                            -->
	<xsl:template match="Type">
		<xsl:variable name="type-val"><xsl:value-of select="normalize-space(./text())"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$type-val = 'DBTYPE_BSTR'">    nvarchar	    </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_WSTR'">    univarchar   </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_STR'">     varchar      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_BOOL'">    bit          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I1'">      tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I2'">      smallint     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I4'">      int          </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_I8'">      bigint       </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI1'">     tinyint      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI2'">     unsigned smallint </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI4'">     unsigned int      </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_UI8'">     unsigned bigint   </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R4'">      real         </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_R8'">      float        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DATE'">    datetime     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DBTIMESTAMP'">    datetime     </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_CY'">        money        </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_VARIANT'">   varbinary  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_GUID'">      varchar  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_ByteArray'"> varbinary  </xsl:when>
			<xsl:when test="$type-val = 'DBTYPE_DECIMAL'">   decimal      </xsl:when>
		</xsl:choose>
		<xsl:apply-templates select="./Size"/>
		<xsl:apply-templates select="./Precision"/>
		<xsl:apply-templates select="./Scale"/>		
	</xsl:template>

	<!-- Size (optional)                                                  -->
	<xsl:template match="Size">
	( <xsl:value-of select="./text()"/> )
	</xsl:template>
	
	<!-- Precision (optional)                                                  -->
	<xsl:template match="Precision">
	( <xsl:value-of select="./text()"/>
	</xsl:template>

	<!-- Scale (optional)                                                  -->
	<xsl:template match="Scale">
	, <xsl:value-of select="./text()"/> )
	</xsl:template>
	<!-- Cast                                                             -->
	<xsl:template match="Cast">
		CAST(<xsl:apply-templates select="./*[1]"/> AS <xsl:apply-templates select="./*[2]"/>)
	</xsl:template>
	
	<!-- By default don't do anything                                     -->
	<xsl:template match="*">
	</xsl:template>

	<!-- Print a schema object                                               -->
	<xsl:template name="build-quoted-schema-object"> 
		<xsl:param name="schema-object-node" select="."/>

		<xsl:variable name="schema">
			<xsl:apply-templates select="$schema-object-node/Schema"/>
		</xsl:variable>
		<xsl:variable name="table">
			<xsl:apply-templates select="$schema-object-node/Name"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$schema = ''">
				<xsl:value-of select="$table"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat($schema,'.', $table)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Convert an identifier to the OLEDB quotation form                -->
	<xsl:template name="quote-identifier"> 
		<xsl:param name="identifier" select="."/>

		<xsl:value-of select="$IdentifierStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$identifier"/>
			<xsl:with-param name="end-quoting-char" select="$IdentifierEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$IdentifierEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert a string to the string quotation form                    -->
	<xsl:template name="quote-string"> 
		<xsl:param name="string" select="."/>

		<xsl:value-of select="$StringStartQuotingCharacter"/>
		<xsl:call-template name="normalize-entity-aux">
			<xsl:with-param name="entity" select="$string"/>
			<xsl:with-param name="end-quoting-char" select="$StringEndQuotingCharacter"/>
		</xsl:call-template>
		<xsl:value-of select="$StringEndQuotingCharacter"/>
	</xsl:template>

	<!-- Convert an entity to the quotation form (recursive, aux)  by
         duplicating the end quoting character                            -->
	<xsl:template name="normalize-entity-aux"> 
		<xsl:param name="entity"/>
		<xsl:param name="end-quoting-char"/>

		<xsl:choose>
			<xsl:when test="contains($entity, $end-quoting-char)">
				<xsl:value-of select="substring-before($entity, $end-quoting-char)"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:value-of select="$end-quoting-char"/>
				<xsl:call-template name="normalize-entity-aux">
					<xsl:with-param name="entity" select="substring-after($entity, $end-quoting-char)"/>
					<xsl:with-param name="end-quoting-char" select="$end-quoting-char"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$entity"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- Print the children list                                          -->
	<xsl:template name="print-children-list">
		<xsl:param name="operator" select="','"/>
		
		<xsl:call-template name="print-list">
			<xsl:with-param name="value-node" select="./*"/>
			<xsl:with-param name="operator" select="$operator"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Print a list                                                     -->
	<xsl:template name="print-list">
		<xsl:param name="operator" select="','"/>
		<xsl:param name="value-node" select="."/>

		<xsl:for-each select="$value-node">
			<xsl:apply-templates select="."/>
			<xsl:if test="position()!=last()">
				<xsl:value-of select="$operator"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter-ref">
		<xsl:param name="parameter-reference"/>

		<xsl:variable name="reference"><xsl:value-of select="$parameter-reference/@ref"/></xsl:variable>
		<xsl:call-template name="print-non-parametric-parameter">
			<xsl:with-param name="parameter" select="/Statement/Parameters/Parameter[@id=$reference]"/>
		</xsl:call-template>
	</xsl:template>

	<!-- Get the value of a parameter ref for the query                   -->
	<xsl:template name="print-non-parametric-parameter">
		<xsl:param name="parameter"/>

		<xsl:variable name="db-type"><xsl:value-of select="$parameter/@DBTYPE"/></xsl:variable>
		<xsl:variable name="value"><xsl:value-of select="$parameter/text()"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="$db-type = 'DBTYPE_BSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_WSTR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_STR'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_BOOL'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS bit)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_I8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI1'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI2'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_UI8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R4'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_R8'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DATE'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS datetime)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DBTIMESTAMP'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS datetime)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_CY'">CAST( <xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template> AS money)</xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_VARIANT'"><xsl:value-of select="$value"/></xsl:when>
                        <xsl:when test="$db-type = 'DBTYPE_GUID'"><xsl:call-template name="quote-string"><xsl:with-param name="string" select="$value"/></xsl:call-template></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_ByteArray'"><xsl:value-of select="$value"/></xsl:when>
			<xsl:when test="$db-type = 'DBTYPE_DECIMAL'"><xsl:value-of select="$value"/></xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
BSJBv4.0.30319l7#~77#Stringspo#US #GUID0  #BlobW		%3#;50p

%
kK
pK
K
K
|K
K
K
KlQ
Q	K		

K
K
*
1J
T
8
WK.o^z:&&'&''''''('('7(']('v('('('('('('+))?)n)N))N)
)K)&)*
-*KC*q***/+++C+v++	+	+	
+K},
,
,,,
-=-F-N-U-Z-`-f-l-q-x----'--
--
-
.
).A.
i.o.
.
.
..'.//>////A0
e0
z0
0K
0K
0K1,-1Q11112
:2	[2,n2N)2'22223C323n3b3|333z33333&4=4X44Q.BO yO	 OJWOL\OOcORcRs}"7EOZdoz
 !$%&* -)6)4;6VV'V'V'V'VVV
V1VKViVVVVVVVV,VAVTVhV{VVVVVVVV5Q'Q'Q'Q'Q'Q'Q'Q	')	H	c	"o	'{	'	&	&	*			

0
>
H
]
m
.
61
1
1
11?1\1z111111,1I1kGWW:'V:V:VVV!V/V<VNVVZVmVVVV&V;VVbVV~VVVHV VxVVVVVV V0V@

VVVVVVVV	V V0VAVSVlVyVVVVVVVVVVV V6V=VDVNVYVeVjVvVVVVVVVVVV(V<VOcsQQQQQQQQQQ('Q='P[i.262:
(9HWdt22'VVV'VAVSVlVyVVVVVVVVVVV V6V=VDVNVYVeVjVvVVVVV'V V V V V( V< VO 'V$V$V$V$V$V$V$V$V$V$V!$V,$V7$VA$VK$VW$Vj$Vt$V$V$V$(GKiks(ik(s(( (
     #!$(!'-!'7!'ik !!!!!!"!" "("# n#y#! "#:'V#:V#:V$:V$:V$:V$:V'$:V,$:8$RC$VGN$ZY$^4 N





=
[	
o	












)
=
s


 
>!
L"
Y"]$e&m&t '{"8'
{&'3
*'D
*'	T
*(	h
*\(|
+(	
,(	
,(
-(
-0)
/\)2) 4*67+`8h0j@t0xA3E3F(5K@5M5Nt:	S|:	S:	T:	T:	U:	=U:	[V:	oV:	W:	W:	X:	X:	Y:	Y:	Z:	Z:	)[;	=[
;	s\;	\.;	]6;	]O;^`;H_=ibX=d=g=h=i>$kH?mL>T2Ym?m?m?
m?n@3n@o@o@3o$@p,@p5@/q=@4qF@rN@:CrU@FHr]@Rsi@hsu@|s@s@s@s@s@s@s@s@(s@Cs@gs@~sAsAsAs)As5AsAANsNA&Nt[A;NuhAbNvuA~NwANxA NyAxNzAN{AN|AN}AN~AA:CAFHANB
;BT2YpBxBBBBBBCC	CC/ CD(CW?CjVC{CCCC>C>CCCKPDWD)\E5b(E>WtEVE[dHn9IhHInJxJdMTOOQQxS#SJTT-T3T:DUWUN_U/RhU?WpUN\|U:UU~oUtU-U3V:V~oVtV-V3V:pWWW& W3 W-W3W@ -WK 3WV -W_ 3Wh Xu X X  X:Y Y Y!Y!Y:0Z8Z\ZZ=!ZF!ZO!ZX!Za!Zo!Z}!Z!Z:[!]	]]5]K]!S]"\]"d] "m]*"u]7"~]D"o]R"t] ] ]`"]m"]z"]"]"]"]:G_O_^_"f_"p_:__&_& _3 _"_"_"_ "_:I`g`#-o`#3x`:``3#`H#a:8a-Na3kaa#a#a#a#a"a "a a a:bbb"b"b#?b#Eb b b:ccc$bcr$gc?WcN\c$mc$rc$xc$}c$c$cd$W$$$%
%%%%%%%%%%%%$$$%
%$$$%%$%$ %%% %%%%%%%3%%%%%3%%B%%$J%W%b%l%w%y#%%y##!w%%%%y#$%%w%%%%y#w%w%%%%y#%%%$%$%
%%%%%%%%%%%%%$%&G&
%$Y&f&n&v&%n&%&%%%%%%n&Y&n&n&#!#!y#y#y#&&&%&&&&&&&P[&&&&'P[&&&&&&	'&&''*'2'A'W'l'l'l'l'%	'%%	'%%	'%%	'%%%%%%	'%%	'#!#!%%%%	'z'i!i! !%%%%%%%%	'"%	'" %%%	'%	'"#%	'n#y#n#y#! !%%%%	' %%%	'%%%%%%'
!)19AIQYaiqyI)**#*7*K*7*Y*b*	}**Y*********-+3}*:*L*}*:$*LY*$*4+tS+z`+j+p+++	++!+!+)+1+a+),),a,a7,IK,],d,hl,s,,I#*Q*l,
,&Y,Y	-+-97*A*I}*-I-CY*N*U-Z
.`X!1.fo!k!kO!9.p	Y*Z.v*U}.|,...).-1.+	-A*.*s,A-	..9/I)IJ/I^/Il/Iz/I/I//Q*5a=I0CI0I,0C[0^q*dy000A0#*)0)0-+11*'1;1'1;1D1V1g1|1,1Z.A1A1`+Y*129-I!2*I*i.29Q62?J2N2i	h2Cl,o22~.2],233R3!)133*l,Y34Y243	34R43ii448J4IyOyl4-y4V#*}*4`4`	444*45-
5553"5}*Y*+585F5z*/4/9B k$($,0W4W8^<i@DHLPMT\Xk\x`	d	h/lptx]|@/DHXL{PTX\`d;h`lptx
|3Nu	5	\					%
D



,eZ,
[



! N$(,0,4K8j<@DHL)PPTmX\`dUhlptAxv|8I)/ (/,048<@)DHLPT*X\`dhlptx|/)/)*/).3.;)...#.+.CV.Kh.S.[.cb.kb.sb..Q#)bIbcY,Jm%5T]y?e%4Ehs
 	45DEGIKQSW_`cde i"lg$7AVfv+$7AVfviww>S!/<NZmH 0@Sp{ 0	A]bfzAzA A A A1!!!"""z!""!" ""#A]###""#LofzZd			



$%'(8!7!9#:#<%;%>'='?)@)B+A+C-D-E/F/G1H1I3J3K5L5Y7X7[9Z9];^;`=_=b?a?dAeAfCgEhGiIjKkMlOmQnSoUpWqYr[s]t_uavcwexgiikmoqsuwy{}	

#"$%&'+*,-./1023DQ6)
,


W5 5%56P<6p66Ȅ67fI7	! <Module>Microsoft.SqlServer.DMQueryTask.dllAssemblyVersionInfoIDMQueryTaskMicrosoft.SqlServer.Dts.Tasks.DMQueryTaskDMQueryTaskInputParameterResultParameterParameterResultTypeSRKeysParamNamesMicrosoft.DataWarehouse.DesignSupportedNamesLimitNamesSchemaClassInfoRDMSCartridgeImplementationFlavorSupportedEnumLimitEnumRDMSDBTypeRDMSUnionRDMSSampleRDMSCreateRDMSInsertRDMSSelectRDMSColumnUpdateRDMSTypeRDMSColumnRDMSMaxRDMSCountRDMSFromRDMSOpaqueExpressionRDMSTableRDMSWhereOperatorTypeRDMSXmlWrappermscorlibSystemObjectMicrosoft.SqlServer.ManagedDTSMicrosoft.SqlServer.Dts.RuntimeTaskIDTSBreakpointSiteIDTSSuspendIDTSComponentPersistEnumVersionStringMajorVersionMinorVersionBuildVersionSPLevelProductVersionStringProductNameStringSqlEngineUsageMetricsRoleGuidStringProductNameBrandingStringLongProductNameBrandingStringProductNameShortcutBrandingStringVersionLocationStringProductVersionLocationStringVersionHelpKeywordPrefixVersionHelpSettingsTokenSetupSupportFolderProductLicenseFileProductUpdateCategorySqlProductFamilyCodeProductDiscoveryIdSqlInstanceIDPrefixAsInstanceIDPrefixRsInstanceIDPrefixMaxMaintenanceVersionevalTimeBombValuecurrentReleaseTimeBombValueWerEventNameSetupMsiWerEventNameSetupConfigASUsageMetricsRoleGuidStringVersionBIDSHelpNamespaceVisualStudioShellVersionget_VersionHelpNamespaceVersionHelpNamespaceConnectionsVariableDispenserIDTSComponentEventsIDTSLoggingExecuteQueryget_QueryStringset_QueryStringget_QueryBuilderQueryStringset_QueryBuilderQueryStringget_QueryBuilderSpecificationset_QueryBuilderSpecificationget_InputConnectionset_InputConnectionget_OutputConnectionset_OutputConnectionget_ModelStructureNameset_ModelStructureNameget_ModelNameset_ModelNameget_OverwriteOutputTableset_OverwriteOutputTableget_OutputTableNameset_OutputTableNameSystem.Collections.GenericList`1get_InputParametersset_InputParametersget_ResultParametersset_ResultParametersQueryStringQueryBuilderQueryStringQueryBuilderSpecificationInputConnectionOutputConnectionModelStructureNameModelNameOverwriteOutputTableOutputTableNameInputParametersResultParametersDefaultStringColumnSizeDefaultBinaryColumnSizeDefaultPrecisionDefaultScaleCommitBatchSizeResultSetType_NoneBeforeQueryExecutionBPIdAfterQueryExecutionBPIdEmbeddedCartridgeResourceNamesm_ResultBreakpointManagerm_bpManagerm_debugModem_suspendRequiredSystem.ThreadingManualResetEventm_suspendedm_canExecutem_eventsqueryStringqueryBuilderQueryStringqueryBuilderSpecificationinputConnectionoutputConnectionstructureNamemodelNameoverwriteOutputTableoutputTableNameinputParameterListresultParameterListDTSExecResultExecuteValidateget_ExecutionValueRootElementNodeNameQueryStringAttributeNameQueryBuilderQueryStringAttributeNameQueryBuilderSpecificationAttributeNameInputConnectionAttributeNameOutputConnectionAttributeNameModelStructureNameAttributeNameModelNameAttributeNameOverwriteOutputTableAttributeNameOutputTableNameAttributeNameInputParameterBindingElementNameParameterNameAttributeNameDtsVariableNameAttributeNameResultParameterBindingElementNameResultTypeAttributeNameSystem.XmlXmlElementIDTSInfoEventsLoadFromXMLXmlDocumentSaveToXMLXmlNodeGetAttributeStringValueGetAttributeIntValueWriteAttributeStringValueWriteSensitiveStringValueSuspendExecutionResumeExecutionget_SuspendRequiredset_SuspendRequiredAcceptBreakpointManagerget_DebugModeset_DebugModeCheckAndSuspendCheckAndFireBreakpointEncodeObjectNameSystem.DataSystem.Data.CommonDbConnectionTableExistsDropTableDbTypeTypeGetRestrictedDbTypeDataTableIDataReaderRowInsertUseBulkInsertCreateTableGetCatridgeSystem.Data.SqlClientSqlConnectionBulkInsertSqlRowsCopiedEventArgsbulkCopy_SqlRowsCopiedCreateResultTableDisposeDatareaderMicrosoft.AnalysisServices.AdomdClientAdomdConnectionExecuteDMQueryConnectionManagerAcquireDatabaseConnectionValidateConnectionFireProgressEventFireErrorEventWriteLogChangeEvent.ctorExecutionValueSuspendRequiredDebugModeget_ParameterNameset_ParameterNameget_DtsVariableNameset_DtsVariableNamem_parameterNamem_dtsVariableNameParameterNameDtsVariableNameget_ResultNameset_ResultNameget_ResultTypeset_ResultTypem_resultNamem_resultTypeResultNameResultTypevalue__SingleRowResultFullResultSetSystem.GlobalizationCultureInfoget_Cultureset_Cultureget_StartQueryLogTextget_EndQueryLogTextget_BeforeQueryBPget_AfterQueryBPget_SyncFailedMessageget_ErrorSourceget_DMQueryStrinNotSetget_OutputTablenameNotSetget_InputConnectionNotSetget_InputDatabaseNotSetget_OutputConnectionNotSetget_AcquireDatabaseConnectionFailedget_InvalidRootElementget_ConnectingToDatabaseget_ExecuteDMQueryget_SetResultToVariableget_TaskDisplayNameget_TaskDescriptionget_DatasourceInformationNotFoundValidateTaskFailedMessageConnectionIdNotFoundAcquireDatabaseConnectionFailedMessageQueryExecutionFailedMessageUnsupportedConnectionTypeUnsupportedDataTypeInsertIntoTableDTSVariableBindingFailedNoMatchingResultNameResultNotSetCultureStartQueryLogTextEndQueryLogTextBeforeQueryBPAfterQueryBPSyncFailedMessageErrorSourceDMQueryStrinNotSetOutputTablenameNotSetInputConnectionNotSetInputDatabaseNotSetOutputConnectionNotSetAcquireDatabaseConnectionFailedInvalidRootElementConnectingToDatabaseSetResultToVariableTaskDisplayNameTaskDescriptionDatasourceInformationNotFoundSystem.ResourcesResourceManagerresourceManager_cultureGetStringCanUseParamsIdentStartQuoteIdentEndQuoteStringStartQuoteStringEndQuoteDateStartQuoteDateEndQuoteIdentInvalidCharactersDateValueFormatDateColumnFormatLinkChildToParentRecursiveSelectsSubqueryDataSamplingDatePartYearDatePartQuarterDatePartMonthDatePartDayOfYearDatePartDayDatePartWeekDatePartDayOfWeekDatePartHourDatePartMinuteDatePartSecondDatePartMillisecondMultipleDistinctCountUpdateInsertSubselectTableAliasColumnAliasCastRemoteQueryTopClauseUnionMatViewPrevalidationUnionAllFastWriteBackRemoteConnectionStringMappingsRecursiveSelectsDatabaseIdentifierLengthTableIdentifierLengthColumnIdentifierLengthMatViewSupportLevelMatViewColumnLimitMaxConnectionsCountManagedProviderAssemblyNameClassNameQueryDesignerAssemblyNameQueryDesignerClassNamexslFileExturinsPrefixxslurixslnsPrefixproviderXmlTagcapabilitiesXmlTagschemaClassesXmlTagparamXmlTagmaxNumSupportsRecordmaxNumLimitsRecordserverNameserverVersioncurrentDirectorySystem.Xml.XslXslTransformcurrentXslTransSystem.CollectionsHashtablesupportsToEnumMappingsupportslimitsToEnumMappinglimitscanUseParamsidentStartQuoteidentEndQuotestringStartQuotestringEndQuotedateStartQuotedateEndQuotedateValueFormatdateColumnFormatidentInvalidCharactersfastWriteBackremoteConnectionStringMappingsschemaClassesget_ServerNameget_ServerVersionget_CanUseParamsget_IdentStartQuoteget_IdentEndQuoteget_StringStartQuoteget_StringEndQuoteget_DateStartQuoteget_DateEndQuoteget_DateValueFormatget_DateColumnFormatget_IdentInvalidCharactersget_FastWriteBackget_RemoteConnectionStringMappingsget_SchemaClassesLoadXSLSystem.IOStreamTranslateDoesSupportGetLimitRemoveInvalidCharactersInitCreateSupportsListCreateLimitsListGetProviderStringFindCorrectXSLXmlNodeListIsCorrectXSLDocSetParamPropertiesSetSchemaClassesSetSupportedCapabilitiesGenerateSchemaClassesGenerateSchemaClassGenerateRemoteConnectionStringMappingsGenerateRemoteConnectionStringMappingServerNameServerVersionSchemaClassesDontKnowNativeOledbManagedDBTYPE_BSTRDBTYPE_WSTRDBTYPE_STRDBTYPE_BOOLDBTYPE_I1DBTYPE_I2DBTYPE_I4DBTYPE_I8DBTYPE_UI1DBTYPE_UI2DBTYPE_UI4DBTYPE_UI8DBTYPE_R4DBTYPE_R8DBTYPE_DATEDBTYPE_DBTIMESTAMPDBTYPE_CYDBTYPE_VARIANTDBTYPE_GUIDDBTYPE_ByteArrayDBTYPE_DECIMALuseUnionAllArrayListrdmsSelectsget_RDMSSelectsset_RDMSSelectsGetXmlNodeRDMSSelectsrdmsSelectmaxRowCountget_MaxRowCountset_MaxRowCountget_RDMSSelectset_RDMSSelectMaxRowCountrdmsTablecolColumnsget_Tableset_Tableget_Columnsset_ColumnsTableColumnscolumnUpdatesget_ColumnUpdatesset_ColumnUpdatesColumnUpdatescolCountscolMaxsrdmsFromrdmsWheredistinctget_Distinctset_Distinctget_Countsset_Countsget_Maxsset_Maxsget_RDMSFromset_RDMSFromget_RDMSWhereset_RDMSWhereDistinctCountsMaxsrdmsColumnrdmsOpaqueExpressionget_RDMSOpaqueExpressionset_RDMSOpaqueExpressionget_RDMSColumnset_RDMSColumntypesizeprecisionscaleget_Typeset_Typeget_Sizeset_Sizeget_Precisionset_Precisionget_Scaleset_ScaleConvertSystemTypeToRDMSDBTypeSizePrecisionScalecolumnNameasteriskaliasrdmsTypeusagecastToTypeget_ColumnNameset_ColumnNameget_Aliasset_Aliasget_Asteriskset_Asteriskget_RDMSTableset_RDMSTableget_RDMSTypeset_RDMSTypeget_Usageset_Usageget_CastToTypeset_CastToTypeColumnNameAliasAsteriskUsageCastToTypecolumnget_Columnset_ColumnColumncolTablesget_Tablesset_TablesTablesopaqueExpressionget_OpaqueExpressionset_OpaqueExpressionOpaqueExpressionschemaNametableNameget_SchemaNameset_SchemaNameget_TableNameset_TableNameSchemaNameTableNameoperget_Operatorset_OperatorOperatorAndOrEqualNotEqualGreaterGreaterOrEqualLessLessOrEqualrdmsCreaterdmsInsertrdmsSamplerdmsUnionget_RDMSCreateset_RDMSCreateget_RDMSInsertset_RDMSInsertget_RDMSUnionset_RDMSUnionget_RDMSSampleset_RDMSSampleGetSqlStatementconnectionsvariableseventslogtxnvalueelementdocnodeattributeNameattributeValuemanagerbreakpointIDobjectNameopenQuotecloseQuotedbConnectiondatasourceConnectioncartridgeschemaTablereaderresultTablefirstRowColumnValuessenderevariablesDispenserdataReadervariableDispenserconnectionSystem.Runtime.InteropServicesOutAttributeconnectionManagerconnectionIdisInputmessageerrorMessageshouldSetvariableNameresultNamekeyarg0directoryproviderimplementationFlavorcartridgesxmlInputsupportEnumlimitEnuminStringxmlDocspecificSizecapabilitiesparamssnodeListParamsnodeListSchemaClassesnodeListCapabilitiesxmlParentNodesystemTypexmlQueryComVisibleAttributeSystem.ReflectionAssemblyVersionAttributeAssemblyProductAttributeAssemblyCopyrightAttributeAssemblyCompanyAttributeAssemblyFileVersionAttributeAssemblyInformationalVersionAttributeAssemblyKeyFileAttributeAssemblyDelaySignAttributeAssemblyTrademarkAttributeAssemblyTitleAttributeAssemblyDescriptionAttributeAssemblyConfigurationAttributeAssemblyCultureAttributeSystem.DiagnosticsDebuggableAttributeDebuggingModesSystem.Runtime.CompilerServicesCompilationRelaxationsAttributeRuntimeCompatibilityAttributeMicrosoft.SqlServer.DMQueryTaskDtsTaskAttributeGuidAttributeFireQueryCancelExceptionget_MessageStringget_Lengthget_CountDtsObjectop_EqualityBooleanget_LocalNameToStringget_ChildNodesIEnumeratorGetEnumeratorget_CurrentXmlNodeTypeget_NodeTypeAddget_Nameget_InnerTextMoveNextIDisposableDisposeFireErrorCreateElementAppendChildEnumeratorInt32XmlAttributeCollectionget_AttributesXmlNamedNodeMapGetNamedItemget_ValueEmptyParseXmlAttributeCreateAttributeset_ValueAppendset_InnerTextMonitorEnterExitWaitHandleWaitAnyInterlockedExchangeBreakpointTargetCreateBreakpointTargetWaitOneIsBreakpointTargetEnabledGetBreakpointTargetFireBreakpointHitConcatReplaceFormatGetSchemaDataRowCollectionget_RowsInternalDataCollectionBaseSystem.ComponentModelMarshalByValueComponentDbCommandCreateCommandset_CommandTextExecuteNonQueryRuntimeTypeHandleGetTypeFromHandleDateTimeDecimalDoubleGuidSByteInt16Int64ByteUInt16UInt32UInt64SingleMemberInfoApplicationExceptionDataRowget_Itemget_InvariantCultureIFormatProviderIDbCommandIDbDataParameterCreateParameterIDataParameterset_DbTypeConvertToInt32NewGuidIDataParameterCollectionget_ParametersIListDbTransactionBeginTransactionIDbTransactionset_TransactionPrepareReadIDataRecordGetValuesDBNullValueCommitGetTypeAssemblyget_AssemblyGetManifestResourceStreamSystem.Data.OleDbOleDbConnectionSqlBulkCopyset_BulkCopyTimeoutset_BatchSizeget_BatchSizeset_NotifyAfterset_DestinationTableNameSqlBulkCopyColumnMappingCollectionget_ColumnMappingsSqlBulkCopyColumnMappingSqlRowsCopiedEventHandleradd_SqlRowsCopiedWriteToServerremove_SqlRowsCopiedOperationAbortedExceptionset_AbortDataColumnCollectionDataColumnset_MaxLengthop_InequalityGetSchemaTableVariablesLockOneForWriteDTSReadOnlyCollectionBaseget_FieldCountGetNameVariableUnlockReleaseConnectionComponentClearIEnumerable`1AddRangeAcquireConnectionget_CreationNameget_ConnectionStringset_ConnectionStringAdomdCommandset_ConnectionAdomdParameterCollectionLockForReadGetVariablesAdomdParameterOpenAdomdDataReaderCommandBehaviorExecuteReaderFireProgressget_NowLogEventWaitHandleSetReset.cctorBrowsableAttributeCompilerGeneratedAttributeget_CurrentCultureget_FullNameModuleget_ModuleIsNullOrEmptyStringReaderXmlTextReaderTextReaderDtdProcessingset_DtdProcessingXmlReaderLoadget_DocumentElementSystem.Xml.XPathXPathNavigatorCreateNavigatorSystem.TextStringBuilderStringWriterXmlUrlResolverXsltArgumentListTextWriterXmlResolverTransformSubstringFileInfoFileSystemInfoget_ExtensionStringComparisonEqualsCreateset_PositionDirectoryInfoGetFilesXmlNameTableget_NameTableXmlNamespaceManagerAddNamespaceSelectNodesStartsWithget_ItemOf<PrivateImplementationDetails>{EE9B0499-607F-4610-B1EA-E983CF182DF0}Dictionary`2$$method0x60000aa-1TryGetValueToInt64IndexOfTrimContainsget_OuterXmlget_LastChildSelectSingleNodeMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.SR.resourcesMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.Graphics.DMQueryTask.icoMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.db2v0801.xslMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.msjet.xslMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.orcl7.xslMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.sql2000.xslMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.sql70.xslMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.trdtv2r41.xslMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.informix.xslMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.sybase.xsl-ms-help://MS.SQLCC.v11Sensitive1{0}{1}{2}
TablesDROP TABLE {0}ColumnName@param{0}?DataTypeColumnSize!NumericPrecisionNumericScale+DataSourceInformation+DataSourceProductName1DataSourceProductVersion
StatusmMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.db2v0801.xslgMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.msjet.xslgMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.orcl7.xslkMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.sql2000.xslgMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.sql70.xslgMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.sql90.xsloMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.trdtv2r41.xslmMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.informix.xsliMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.sybase.xslDMQuertTaskDataQueryString/QueryBuilderQueryString3QueryBuilderSpecificationInputConnection!OutputConnection%ModelStructureNameModelName)OverwriteOutputTableOutputTableName+InputParameterBindingParameterNameDtsVariableName-ResultParameterBindingResultType#StartQueryLogTextEndQueryLogTextBeforeQueryBPAfterQueryBP#SyncFailedMessageErrorSource%DMQueryStrinNotSet+OutputTablenameNotSet+InputConnectionNotSet'InputDatabaseNotSet-OutputConnectionNotSet?AcquireDatabaseConnectionFailed%InvalidRootElement)ConnectingToDatabaseExecuteDMQuery'SetResultToVariableTaskDisplayNameTaskDescription;DatasourceInformationNotFound3ValidateTaskFailedMessage)ConnectionIdNotFoundMAcquireDatabaseConnectionFailedMessage7QueryExecutionFailedMessage3UnsupportedConnectionType'UnsupportedDataTypeDropTableCreateTableInsertIntoTable1DTSVariableBindingFailed)NoMatchingResultNameResultNotSet7{0:yyyy-MM-dd HH':'mm':'ss}{0}Asupports-link-children-to-parentEsupports-recursive-select-subquery-supports-data-sampling-supports-datepart-year3supports-datepart-quarter/supports-datepart-month7supports-datepart-dayofyear+supports-datepart-day-supports-datepart-week7supports-datepart-dayofweek-supports-datepart-hour1supports-datepart-minute1supports-datepart-second;supports-datepart-millisecondAsupports-multiple-distinct-countsupports-updatesupports-insert%supports-subselect)supports-table-alias+supports-column-alias+supports-remote-query'supports-top-clausesupports-unionQsupports-materialized-view-prevalidation%supports-union-all/supports-fast-writebackCremote-connection-string-mappingssupports-cast3supports-recursive-selectAlimit-database-identifier-length;limit-table-identifier-length=limit-column-identifier-length5supports-materialized-viewIlimit-materialized-view-column-count7limit-max-connections-count{0}.{1}	.XSLmssqlcrt9urn:sql-microsoft-com:sqlcrtxslIhttp://www.w3.org/1999/XSL/Transform#mssqlcrt:provider	type
prefixmanagedno
native+mssqlcrt:capabilities/mssqlcrt:schema-classesxsl:param	namein_CanUseParams;in_IdentStartQuotingCharacter7in_IdentEndQuotingCharacter=in_StringStartQuotingCharacter9in_StringEndQuotingCharacter9in_DateStartQuotingCharacter5in_DateEndQuotingCharacter%in_DateValueFormat'in_DateColumnFormat3in_IdentInvalidCharactersyesschema-class!managed-provider,query-designerAremote-connection-string-mapping'datasource-propertyremote-propertyUnionUnionAll
SampleMaxRowCount
Create#ColumnDefinitions
Insert
TargetColumnUpdates
SelectDistinct#ColumnExpressionsWhere
Assign	Type	SizePrecisionScaleSQLColumn
ColumnAsterisk	NameUsage	CastAsMaxCountSources!OpaqueExpressionTable
SchemaEqualNotEqualAndGreater	LessGreaterOrEqualLessOrEqualStatement	Text`F-z\V4]̀̑11.0.0.0411.0(Microsoft SQL Server{0xbd7f7c0d, 0x7c36, 0x4721, {0xaf, 0xa8, 0xb, 0xa7, 0x0, 0xe2, 0x6d, 0x9e}}SQL Server 20122Microsoft SQL Server 2012110
sql112SQLServerBooksOnline.11.0SQLServer2012H7fe4630a-0330-4b01-a5e6-a77c7ad34eb0L{7f121c35-f095-47aa-bc04-d214bc04727a}SQL2011MSSQL11MSAS11MSRS11	SQL110MSISQL110Exception{0x2414bc1b, 0x1572, 0x4cd9, {0x9c, 0xa5, 0x65, 0x16, 0x6d, 0x8d, 0xef, 0x3d}}*ms-help://MS.VSCC.v9010.0 !%)     -	 - -	 -(((-(-'15%--
 9!%) 9!%)  =A EAII	E=  1 %  M M8QU M8Y]%Y M
 M8Y 8M a8Y] e YY ] ]!i Mm m )5(  (qqq"StartQueryLogTextEndQueryLogTextBeforeQueryBPAfterQueryBP"SyncFailedMessageErrorSource2ValidateTaskFailedMessage$DMQueryStrinNotSet*OutputTablenameNotSet*InputConnectionNotSet&InputDatabaseNotSet,OutputConnectionNotSet(ConnectionIdNotFoundLAcquireDatabaseConnectionFailedMessage>AcquireDatabaseConnectionFailed6QueryExecutionFailedMessage$InvalidRootElement2UnsupportedConnectionType&UnsupportedDataType(ConnectingToDatabaseExecuteDMQueryDropTableCreateTableInsertIntoTable0DTSVariableBindingFailed&SetResultToVariable(NoMatchingResultNameResultNotSetTaskDisplayNameTaskDescription:DatasourceInformationNotFounduqin_CanUseParams:in_IdentStartQuotingCharacter6in_IdentEndQuotingCharacter<in_StringStartQuotingCharacter8in_StringEndQuotingCharacter8in_DateStartQuotingCharacter4in_DateEndQuotingCharacter2in_IdentInvalidCharacters$in_DateValueFormat&in_DateColumnFormat@supports-link-children-to-parentDsupports-recursive-select-subquery,supports-data-sampling,supports-datepart-year2supports-datepart-quarter.supports-datepart-month6supports-datepart-dayofyear*supports-datepart-day,supports-datepart-week6supports-datepart-dayofweek,supports-datepart-hour0supports-datepart-minute0supports-datepart-second:supports-datepart-millisecond@supports-multiple-distinct-countsupports-updatesupports-insert$supports-subselect(supports-table-alias*supports-column-aliassupports-cast*supports-remote-query&supports-top-clausesupports-unionPsupports-materialized-view-prevalidation$supports-union-all.supports-fast-writebackBremote-connection-string-mappings2supports-recursive-select@limit-database-identifier-length:limit-table-identifier-length<limit-column-identifier-length4supports-materialized-viewHlimit-materialized-view-column-count6limit-max-connections-count.XSL8urn:sql-microsoft-com:sqlcrtmssqlcrtHhttp://www.w3.org/1999/XSL/Transformxsl"mssqlcrt:provider*mssqlcrt:capabilities.mssqlcrt:schema-classesxsl:paramy}
 } < <  @ 
D 	 y< y< E<  I(}<@	

DH   IE(\
 
 
 \ \(
(\| | |(|t t t  (t(hx x x h h(x(h H U H   HU(H(d | | x d d(d h    (TXPL T T X X L L P P 8(T(X(L(P ̀$$RSA1''6n_1:fl/y2}/R4H<=\]Ǽ(k,Q\$+Au2IRmRo{l؂O1
ˢ#V{-Pb왹J|};(ȁETPLocalizationType,Microsoft.SqlServer.Dts.Tasks.DMQueryTask.SRT
UITypeNameMicrosoft.SqlServer.Dts.Tasks.DMQueryTaskUI.DMQueryTaskUI, Microsoft.SqlServer.DMQueryTaskUI, Version=11.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91TIconResourceBMicrosoft.SqlServer.Dts.Tasks.DMQueryTask.Graphics.DMQueryTask.ico)$DF3C9778-2DB4-47C6-BA5A-AFB933958F3C9-	9-     --I = II	  ==  III 
 



=
      Y !Y -	-U1UU  q  y Q A       m1Xm`uUymA TmhUd-A Y m U  Y8 a    	m  UYm Y   &M]imYY8
   i    !
]mM mm
 5 55 q	q     	 = 
  
!%E
   1	 	
Ey)		 )	5) 9 9	 = ==IIAA  I
I

II  
4IIII\
IIIIhIII`"
IIIhplI
IIII	IIIIIIhIII|III|IIIEI I	EIMicrosoft SQL Server)$Microsoft Corp. All rights reserved.Microsoft Corporation,'11.0.2100.60 ((SQL11_RTM).120210-1846 )11.0.2100.6050e:\sql11_main_t\\sql\Common\SNK\SQL2003SNKEY.snkMHMicrosoft SQL Server is a registered trademark of Microsoft Corporation.TWrapNonExceptionThrows5O<RSDSX7AJ>e#;Microsoft.SqlServer.DMQueryTask.pdb _CorDllMainmscoree.dll% H0HX4VS_VERSION_INFO<4<4?DVarFileInfo$TranslationStringFileInfo000004b0LCompanyNameMicrosoft Corporation,FileDescription p(FileVersion11.0.2100.60 ((SQL11_RTM).120210-1846 )h$InternalNameMicrosoft.SqlServer.DMQueryTask.dllp%LegalCopyrightMicrosoft Corp. All rights reserved.ILegalTrademarksMicrosoft SQL Server is a registered trademark of Microsoft Corporation.p$OriginalFilenameMicrosoft.SqlServer.DMQueryTask.dllLProductNameMicrosoft SQL Server@
ProductVersion11.0.2100.60<	Assembly Version11.0.0.0;X<0<H	*H
<90<510	+0L
+7>0<0
+70	0!0	+&
AFۤbڡ\00
aj0
	*H
0y10	UUS10U
Washington10URedmond10U
Microsoft Corporation1#0!UMicrosoft Code Signing PCA0
111101223917Z
130201224917Z010	UUS10U
Washington10URedmond10U
Microsoft Corporation1
0UMOPR10UMicrosoft Corporation0"0
	*H
0
é|#1%uyϓKa%wKZmI17t`N%X N-:e.[]u4P!}9D#fe 6`*dȇE(WY&Jl)2?%
oj-:mf16p@v.G+e+_hExkP5[qa! EeI~7Z߸v Q*P:c܁G00U%0
+0UqÏv,
J(0U0U#0WEt]CT-2H0VUO0M0KIGEhttp://crl.microsoft.com/pki/crl/products/MicCodSigPCA_08-31-2010.crl0Z+N0L0J+0>http://www.microsoft.com/pki/certs/MicCodSigPCA_08-31-2010.crt0
	*H
yiȏk`|>8Rϙ-=au8NY?C|Sb֨vuYl?/~9T'X5aymQWcrf9*35
^15E
]Ǘ*:IHE26m	nvUU4y]n̗h}i{U}M0b{젒*W)HͶ!	b
5_kԱwRw?lV\6N^z  1ynr_0W|UplxC 500
a0
	*H
0w10	UUS10U
Washington10URedmond10U
Microsoft Corporation1!0UMicrosoft Time-Stamp PCA0
110725204219Z
121025204219Z010	UUS10U
Washington10URedmond10U
Microsoft Corporation1
0UMOPR1'0%UnCipher DSE ESN:9E78-864B-039D1%0#UMicrosoft Time-Stamp Service0"0
	*H
0
;SDzMVqSw7~>Sѱ"unav;
CSb83+={EW c4bFٞ9Uw5\HOCX8lKzn`[?:? }m/X}ʊ89h-X#*Z їE7
|ӶSx#!bZjipS4%1UL5[ɫS)_,%d'u	00Uy#
U,h)bg68Z0U#0#4RFp
@v+50TUM0K0IGEChttp://crl.microsoft.com/pki/crl/products/MicrosoftTimeStampPCA.crl0X+L0J0H+0<http://www.microsoft.com/pki/certs/MicrosoftTimeStampPCA.crt0U%0
+0
	*H
Gv[1o<zl~P,DVϽ!dmaCDﭶ\mKC'axT|
tĪ-P}}N'(߱"yam̄ߣ[Tbl'cK߅eiSqd&f\b=KB
8&Z*Kj8sΌP$?xT]%fA(IĴRdMK)?<3ʿ"`\;
m<:ObAv00
ah40
	*H
0_10
	&,dcom10
	&,d	microsoft1-0+U$Microsoft Root Certificate Authority0
070403125309Z
210403130309Z0w10	UUS10U
Washington10URedmond10U
Microsoft Corporation1!0UMicrosoft Time-Stamp PCA0"0
	*H
0
lH*|k.řQ#PN$ѧLt0 TIB\0&k{3$g,{N#SʍE	^аBlg(FS(F.'OUR,j0nY0~֗!~SmREHJGf')fJG	UxP0F#F-TxA1w̛;a
"KT 00U00U#4RFp
@v+50U0	+70U#0`@V'%*
SY䤡ca0_10
	&,dcom10
	&,d	microsoft1-0+U$Microsoft Root Certificate AuthorityyJLsX.e0PUI0G0ECA?http://crl.microsoft.com/pki/crl/products/microsoftrootcert.crl0T+H0F0D+08http://www.microsoft.com/pki/certs/MicrosoftRootCert.crt0U%0
+0
	*H
\D6鴭wyQM.tq[mξ{.mbWN Pz@WXx;⾏
ȍHSOjՀ/*$"px.
pNk
r9g-Qb\? ?21Jv1=+rp=

a׸N5+^}B{Sr!0ʻxe\[
<fX-/QVpl9Lyzb))4wb=m,C}㤨t5Nq#&v<RqZFCMgȟBy!0fB^Ȟ"!C+H,2L&*H$_ZVޙ:o'tv!'Tj=vanGo2lQȌ#fd=-Y!嵰cxTA.Pxuْu"/2n[%!OɚIeo}in꧗1)[\M/?.Uk00i
a'0
	*H
0_10
	&,dcom10
	&,d	microsoft1-0+U$Microsoft Root Certificate Authority0
060125232232Z
170125233232Z0y10	UUS10U
Washington10URedmond10U
Microsoft Corporation1#0!UMicrosoft Code Signing PCA0"0
	*H
0
߅7Vf6N
6#X:
$^>3kir|_%D5(Րap-o,ݹ0qxȩg
z	¼W?i00&Ԟ{	IERu{".VϩN<
:ŭj"#l'~2y%B❅WY/-&)ųׅ`Z{{^4Km'Тѐ}|4lJDyh("
,Ha#00	+70UWEt]CT-2H0U0U00U#0`@V'%*
SY䤡ca0_10
	&,dcom10
	&,d	microsoft1-0+U$Microsoft Root Certificate AuthorityyJLsX.e0PUI0G0ECA?http://crl.microsoft.com/pki/crl/products/microsoftrootcert.crl0T+H0F0D+08http://www.microsoft.com/pki/certs/MicrosoftRootCert.crt0vU o0m0k	+7/0^0\+0PNCopyright  2006 Microsoft Corporation.0U%0
+0
	*H
0 b9&a=ܬƙІ.2e^">ֆ趟ʋ;u>LdtIglfF:FBȑ7$AwO_R/>V[uSTie$%MPO"Y"tE{YL`xѺk~D@ҽKnU8HUz }۔/{kdO,4)]8/ V1i΅
֮8nOL))
\\V#W
&6Do阵sx<t^l!g엝r4/j9-[М|St9J9}BJ;7=J{'NJT8j#7jHB
I$.oEM`Y؀`4{ \	
(M~ex1_fB Ee2.Mkޤ
ؘY ,Rid࣫|aCe6U+g,M0L1%0%00y10	UUS10U
Washington10URedmond10U
Microsoft Corporation1#0!UMicrosoft Code Signing PCA
aj0	+0	*H
	1
+70
+710
+70#	*H
	1C>cw%$Hgww0R
+71D0B SQL Server 2012http://www.microsoft.com/sql0
	*H
R+}-ś?#'΋jmnGֽpCN7T|-lܧ0vykJO.pBKd,_Ea>rypxdCP kfA3u}kL7eJҗr Gɬ!xO؆=>*6ƲF_/3vѦ0Z
_҅Y	{+oGcJ}?~;fnް$'#u0	*H
	1
000w10	UUS10U
Washington10URedmond10U
Microsoft Corporation1!0UMicrosoft Time-Stamp PCA
a0+]0	*H
	1	*H
0	*H
	1
120211180524Z0#	*H
	1ңSߗ7Lj0
	*H
'P]=V^]3CRTQ]7[;A')-
I)bSY;$F}	(zDl,2or?:7W:G3"|fLɳ59lњ'ZiP8PIRA`#@DrB"ͅ>AHa`OHC\{dx-ַ({:C}y0iNZ&v@iwUXuaq,N0!T
+71!D0!@	*H
!10!-10
	`He0\
+7N0L0
+70	010
	`He 54,7F_KʒA7=]vwqa00
aIU0
	*H
0~10	UUS10U
Washington10URedmond10U
Microsoft Corporation1(0&UMicrosoft Code Signing PCA 20100
111010204524Z
130110205524Z010	UUS10U
Washington10URedmond10U
Microsoft Corporation1
0UMOPR10UMicrosoft Corporation0"0
	*H
0
Ϥ01QU4`E)_++rC\;*Yqrx ,8[b}ԯaD9βTK&DOW#Jjة6w4O{_u9}aRƲ~:xȔ=G'rpW0'ca(лbd@"+^wrN|U~\~@6tdW$XkUgZ.i;%00U%0
+0Ui1bqXxa0U#0_{"XrN!t#20VUO0M0KIGEhttp://crl.microsoft.com/pki/crl/products/MicCodSigPCA_2010-07-06.crl0Z+N0L0J+0>http://www.microsoft.com/pki/certs/MicCodSigPCA_2010-07-06.crt0U00
	*H
x[Zm#}u	j'EӒNħe݅JSxA
0 T'Yh8.?iLLx
P:M?+R=Mk&Z\j@K1(|Tp?vY0nm.$X9MRlj[AS{T1
DA~Ri?c2KW8X—@c-mk|+;B+9@"QpA
`&ǩc؅0p0X
aRL0
	*H
010	UUS10U
Washington10URedmond10U
Microsoft Corporation1200U)Microsoft Root Certificate Authority 20100
100706204017Z
250706205017Z0~10	UUS10U
Washington10URedmond10U
Microsoft Corporation1(0&UMicrosoft Code Signing PCA 20100"0
	*H
0
dPyg	LVhDXOv|mE9eҏDe,U}.+A+KnILk‰q͵K̈k:&?4W]I*.ՅY?+t+;FFIfTUbWrg% 4]^(ղcӲȊ&
Y5LR[HwօGj-\`ƴ*[#_Eo73jMjfcx0ϕ00	+70U_{"XrN!t#20	+7
SubCA0U0U00U#0Vˏ\bh=[Κ0VUO0M0KIGEhttp://crl.microsoft.com/pki/crl/products/MicRooCerAut_2010-06-23.crl0Z+N0L0J+0>http://www.microsoft.com/pki/certs/MicRooCerAut_2010-06-23.crt0U 00	+7.00=+1http://www.microsoft.com/PKI/docs/CPS/default.htm0@+042 Legal_Policy_Statement. 0
	*H
tWO){xP"	4*,Ͽ4ہ5oywNaZ#bQEg?<09@!)奡i"tGCS0i% moar,iv=Qۦ9H7amS˧a¿⃫k}(QJQlȷJi~IprGc֢DciFz?!{#-A˿Lﱜ"KInv[Sy=s5<TRGjҎڙg^27uZW¿
-'ӵ^i$gsMOVzRMwOB	
v#Vx"&6ʱnG3bɑ3_q@e"B!%-`7A*a<h`RG@w>SP8f3'9x6N_=GSa=*ג,7Z>@B1V$]Qjy{%qDj#u1000~10	UUS10U
Washington10URedmond10U
Microsoft Corporation1(0&UMicrosoft Code Signing PCA 2010
aIU0
	`He0
*H
	10	*H
	1
+70
+710
+70/	*H
	1" ј/&m@a?`4%0R
+71D0B SQL Server 2012http://www.microsoft.com/sql0
	*H
}hӥoNe&{98H'5Ika<,R&WK;X&
Iq.68@Ce/f GK|YRO@>YlqqmTkD&F:-YvXgNʶx6yEXxuFɒ:{U)<A6|(=|!ECRLOQfn$Q\jz
u@J9SHo#	榣$6740
+710	*H
010	+0**H
	0
+Y
0!0	+Q#C$O1&"T20120211180525.772Z0010	UUS10U
Washington10URedmond10U
Microsoft Corporation1
0UMOPR1'0%UnCipher DSE ESN:936C-7AEE-74AE1%0#UMicrosoft Time-Stamp Service0q0Y
a	*0
	*H
010	UUS10U
Washington10URedmond10U
Microsoft Corporation1200U)Microsoft Root Certificate Authority 20100
100701213655Z
250701214655Z0|10	UUS10U
Washington10URedmond10U
Microsoft Corporation1&0$UMicrosoft Time-Stamp PCA 20100"0
	*H
0

w: iktTե
|hK,_av>f+[S'1A	|a0Y0D`TCM8Bݓs0W&E
GͿ$`2X`FXG2tag_TϓLĦ]an(aF'$gr!KdPb]w=WuBM@Q>gfD~Knʱz*
1N5x</Dd 	xD]^O"M00	+70Uc:\1C{|F3hZmU0	+7
SubCA0U0U00U#0Vˏ\bh=[Κ0VUO0M0KIGEhttp://crl.microsoft.com/pki/crl/products/MicRooCerAut_2010-06-23.crl0Z+N0L0J+0>http://www.microsoft.com/pki/certs/MicRooCerAut_2010-06-23.crt0U 00	+7.00=+1http://www.microsoft.com/PKI/docs/CPS/default.htm0@+042 Legal_Policy_Statement. 0
	*H
Q
?q=!o1Wm0fjxǨ%kTW+QDS`v@@A\\^5$VKtBȯ7}Z?yJR8/ye٩kzoK0D$"<Y)p2J'U/3b_W@ΙfjbJ&9Jqc{!mÜ<}jxm8ؔƥ
B"8 %d~cY%z.9Wvqa˚Gͧ};q	]t"aڰPo1:eGxHr~akow˧	9؂r*T9[
Uzs;-3.)/T'!ȬN(ۖBAM*f0ӻt2Kc{/!YD<PqסUiW0M
]O8/X.
P5	'ճ~56_tI00
aN	0
	*H
0|10	UUS10U
Washington10URedmond10U
Microsoft Corporation1&0$UMicrosoft Time-Stamp PCA 20100
111215031031Z
130315032031Z010	UUS10U
Washington10URedmond10U
Microsoft Corporation1
0UMOPR1'0%UnCipher DSE ESN:936C-7AEE-74AE1%0#UMicrosoft Time-Stamp Service0"0
	*H
0
ؾc0HS<!%5x~B ?+#^ˀÄRU9U?T<>ǘP5Gj+ἃdPeMsؾHu84YR䇉
;G+	TH9Hkd~"AH6/S4J&)IaʱX&_"
wguaS+ƶwp/%B:2AOTlE{@PFWƀb00U?9v5#[LW70U#0c:\1C{|F3hZmU0VUO0M0KIGEhttp://crl.microsoft.com/pki/crl/products/MicTimStaPCA_2010-07-01.crl0Z+N0L0J+0>http://www.microsoft.com/pki/certs/MicTimStaPCA_2010-07-01.crt0U00U%0
+0
	*H
O)KSQ\\s*8hO9KC54Ud"
`΃;@|D[ifa?ann!ҲgR*ru1>QI̐Ԉ!kbب"pQØ9X=pD.mLsT&cYNOg~u:TePbɂ%=e?cbӉ_ɩVK@TA%X,O㣏)}Wrxnj] PLv0^0㡁010	UUS10U
Washington10URedmond10U
Microsoft Corporation1
0UMOPR1'0%UnCipher DSE ESN:936C-7AEE-74AE1%0#UMicrosoft Time-Stamp Service%
0	+^$3+b xc
ցs적0010	UUS10U
Washington10URedmond10U
Microsoft Corporation1
0UMOPR1'0%UnCipher NTS ESN:B027-C6F8-1D881+0)U"Microsoft Time Source Master Clock0
	*H
ϣ0"20120211112939Z20120212112939Z0t0:
+Y
1,0*0
ϣ000
!#06
+Y
1(0&0
+Y

0 
0 0
	*H
*Aܚ}kpEK)pin_f\P0a:>uѣ{77yX&2pR"V>zi]s^FxB>c3n*dQ9ΤMpEh	Dh-ak8I65΢kvg};du;OJ-(N!vm
cPU\d6F!nkBD$>r;,!D]_H7ı!^"z#|RS5]1000|10	UUS10U
Washington10URedmond10U
Microsoft Corporation1&0$UMicrosoft Time-Stamp PCA 2010
aN	0	+0	*H
	1
*H
	0#	*H
	1+r.ҩ +0*H
	1000^$3+b xc
ցs00~0|10	UUS10U
Washington10URedmond10U
Microsoft Corporation1&0$UMicrosoft Time-Stamp PCA 2010
aN	0ZǕ.
Ԥ@0
	*H
dK7e*X.N
XrRWjU7\Cj.Z8:~Y!=+hPC^)F9#Qٕao/hQ'2gƥ]-fC3_峭Pɼ2F($I1fZSq;gC?9#εvz0wsg=9${4=Kyn%|m5E>Z=@
 M϶槅B7r..Cm*Esn

Anon7 - 2022
AnonSec Team