运行xml创建表

时间:2019-05-21 10:06:01

标签: sql-server sql-server-2008-r2 3cx

我正在尝试在查询窗口中运行此xml。

    <?xml version="1.0"?>
<Crm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Country="US" Name="Database MsSQL" Version="1">
  <Number Prefix="AsIs" MaxLength="[MaxLength]" />
  <Connection MaxConcurrentRequests="2" />
  <Parameters>
    <Parameter Name="Server" Type="String" Parent="General Configuration" Editor="String" Title="Server:" />
    <Parameter Name="Database" Type="String" Parent="General Configuration" Editor="String" Title="Database:" />
    <Parameter Name="Username" Type="String" Parent="General Configuration" Editor="String" Title="Username:" />
    <Parameter Name="Password" Type="String" Parent="General Configuration" Editor="String" Title="Password:" />
    <Parameter Name="LookupSQLStatement" Type="String" Parent="General Configuration" Editor="Sql" Title="Lookup SQL Statement:" />
    <Parameter Name="ContactUrlPrefix" Type="String" Parent="General Configuration" Editor="String" Title="Contact URL Prefix:" Default="https://mycrmurl/contacts/" />
    <Parameter Name="ContactUrlSuffix" Type="String" Parent="General Configuration" Editor="String" Title="Contact URL Suffix:" Default="/show" />
    <Parameter Name="ReportCallEnabled" Type="Boolean" Editor="String" Title="Enable Call Journaling" Default="False" />
    <Parameter Name="ReportCallSQLStatement" Type="String" Parent="ReportCallEnabled" Editor="Sql" Title="Call Journaling SQL Statement:" />
    <Parameter Name="CreateContactEnabled" Type="Boolean" Editor="String" Title="Enable Contact Creation" Default="False" />
    <Parameter Name="CreateContactSQLStatement" Type="String" Parent="CreateContactEnabled" Editor="Sql" Title="Contact Creation SQL Statement:" />
  </Parameters>
  <Authentication Type="No" />
  <Scenarios>
    <Scenario Type="SQLDatabase">
      <Query DatabaseType="MsSQL" ConnectionString="Server=[Server];Database=[Database];User Id=[Username];Password=[Password];" StatementPasses="2" Statement="[LookupSQLStatement]" />
      <Rules>
        <Rule Type="Any" Ethalon="">contactid</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID">contactid<Filter /></Variable>
        <Variable Name="FirstName">firstname<Filter /></Variable>
        <Variable Name="LastName">lastname<Filter /></Variable>
        <Variable Name="CompanyName">companyname<Filter /></Variable>
        <Variable Name="Email">email<Filter /></Variable>
        <Variable Name="PhoneMobile">phonemobile<Filter /></Variable>
        <Variable Name="PhoneMobile2">phonemobile2<Filter /></Variable>
        <Variable Name="PhoneHome">phonehome<Filter /></Variable>
        <Variable Name="PhoneHome2">phonehome2<Filter /></Variable>
        <Variable Name="PhoneBusiness">phonebusiness<Filter /></Variable>
        <Variable Name="PhoneBusiness2">phonebusiness2<Filter /></Variable>
        <Variable Name="PhoneOther">phoneother<Filter /></Variable>
        <Variable Name="FaxBusiness">faxbusiness<Filter /></Variable>
        <Variable Name="FaxHome">faxhome<Filter /></Variable>
        <Variable Name="Pager">pager<Filter /></Variable>
        <Variable Name="PhotoUrl">photourl<Filter /></Variable>
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="ContactUrl" Passes="0" Value="[ContactUrlPrefix][ContactID][ContactUrlSuffix]" />
        <Output Type="FirstName" Passes="0" Value="[FirstName]" />
        <Output Type="LastName" Passes="0" Value="[LastName]" />
        <Output Type="CompanyName" Passes="0" Value="[CompanyName]" />
        <Output Type="Email" Passes="0" Value="[Email]" />
        <Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
        <Output Type="PhoneMobile2" Passes="0" Value="[PhoneMobile2]" />
        <Output Type="PhoneHome" Passes="0" Value="[PhoneHome]" />
        <Output Type="PhoneHome2" Passes="0" Value="[PhoneHome2]" />
        <Output Type="PhoneBusiness" Passes="0" Value="[PhoneBusiness]" />
        <Output Type="PhoneBusiness2" Passes="0" Value="[PhoneBusiness2]" />
        <Output Type="PhoneOther" Passes="0" Value="[PhoneOther]" />
        <Output Type="FaxBusiness" Passes="0" Value="[FaxBusiness]" />
        <Output Type="FaxHome" Passes="0" Value="[FaxHome]" />
        <Output Type="Pager" Passes="0" Value="[Pager]" />
        <Output Type="PhotoUrl" Passes="0" Value="[PhotoUrl]" />
      </Outputs>
    </Scenario>
    <Scenario Id="ReportCall" Type="SQLDatabase">
      <Query SkipIf="[ReportCallEnabled]!=True" DatabaseType="MsSQL" ConnectionString="Server=[Server];Database=[Database];User Id=[Username];Password=[Password];" StatementPasses="2" Statement="[ReportCallSQLStatement]" />
      <Variables />
      <Outputs AllowEmpty="false" />
    </Scenario>
    <Scenario Id="CreateContactRecord" Type="SQLDatabase">
      <Query SkipIf="[CreateContactEnabled]!=True" DatabaseType="MsSQL" ConnectionString="Server=[Server];Database=[Database];User Id=[Username];Password=[Password]" StatementPasses="2" Statement="[CreateContactSQLStatement]" />
      <Rules>
        <Rule Type="Any" Ethalon="">contactid</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID">contactid<Filter /></Variable>
        <Variable Name="FirstName">firstname<Filter /></Variable>
        <Variable Name="LastName">lastname<Filter /></Variable>
        <Variable Name="CompanyName">companyname<Filter /></Variable>
        <Variable Name="Email">email<Filter /></Variable>
        <Variable Name="PhoneMobile">phonemobile<Filter /></Variable>
        <Variable Name="PhoneMobile2">phonemobile2<Filter /></Variable>
        <Variable Name="PhoneHome">phonehome<Filter /></Variable>
        <Variable Name="PhoneHome2">phonehome2<Filter /></Variable>
        <Variable Name="PhoneBusiness">phonebusiness<Filter /></Variable>
        <Variable Name="PhoneBusiness2">phonebusiness2<Filter /></Variable>
        <Variable Name="PhoneOther">phoneother<Filter /></Variable>
        <Variable Name="FaxBusiness">faxbusiness<Filter /></Variable>
        <Variable Name="FaxHome">faxhome<Filter /></Variable>
        <Variable Name="Pager">pager<Filter /></Variable>
        <Variable Name="PhotoUrl">photourl<Filter /></Variable>
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="ContactUrl" Passes="0" Value="[ContactUrlPrefix][ContactID][ContactUrlSuffix]" />
        <Output Type="FirstName" Passes="0" Value="[FirstName]" />
        <Output Type="LastName" Passes="0" Value="[LastName]" />
        <Output Type="CompanyName" Passes="0" Value="[CompanyName]" />
        <Output Type="Email" Passes="0" Value="[Email]" />
        <Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
        <Output Type="PhoneMobile2" Passes="0" Value="[PhoneMobile2]" />
        <Output Type="PhoneHome" Passes="0" Value="[PhoneHome]" />
        <Output Type="PhoneHome2" Passes="0" Value="[PhoneHome2]" />
        <Output Type="PhoneBusiness" Passes="0" Value="[PhoneBusiness]" />
        <Output Type="PhoneBusiness2" Passes="0" Value="[PhoneBusiness2]" />
        <Output Type="PhoneOther" Passes="0" Value="[PhoneOther]" />
        <Output Type="FaxBusiness" Passes="0" Value="[FaxBusiness]" />
        <Output Type="FaxHome" Passes="0" Value="[FaxHome]" />
        <Output Type="Pager" Passes="0" Value="[Pager]" />
        <Output Type="PhotoUrl" Passes="0" Value="[PhotoUrl]" />
      </Outputs>
    </Scenario>
  </Scenarios>
</Crm>

不幸的是我遇到错误

    Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '<'.
Msg 132, Level 15, State 1, Line 2
The label 'xmlns' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 1038, Level 15, State 4, Line 23
An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.
Msg 1038, Level 15, State 4, Line 70
An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.

有什么办法可以创建该表或该数据库? 我正在尝试将3cx连接到我的sqlserver。来自3cx的错误消息是

BeginExecuteReader: CommandText property has not been initialized

    Started scenario with empty id
Request text: ConnectionString: Server=(local)\sqlexpress;Database=dbSoft;User Id=sa;Password=1234;
Statement: 

System.InvalidOperationException: BeginExecuteReader: CommandText property has not been initialized
   at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__122_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
   at CrmIntegration.SqlDatabaseClient.Execute(String statement, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.ProcessSQLDatabaseQuery(ISQLClientFactory sqlClientFactory, ScenarioQuery query, IValueManager customManager, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.Execute(ProtocolScenario scenario, CancellationToken token)
   at CrmIntegration.CrmProcessor.GetContactInfoFromCrm(String contactNumber, String destinationEmail, Boolean createIfNotFound, CancellationToken token)

有什么想法吗?我应该手动创建所有表和列吗?

0 个答案:

没有答案