- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我总是收到消息“无法解决等于操作中“SQL_Latin1_General_CP1_CI_AS”和“Latin1_General_CI_AI”之间的排序规则冲突。”当我运行来自 MSSQL 2005 服务器的脚本时。顺便说一句,我使用的是 MSSQL 2008。
这是脚本
USE [database1]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--exec rsp_SOA '', '', '', '', '', '', '40050000', '40050000', '05/01/2010', '05/31/2010', '000-00','Dont Show Note'
ALTER procedure [dbo].[rsp_SOA]
@cCompName VARCHAR(100) ,
@cAddress1 VARCHAR(200) ,
@cAddress2 VARCHAR(200),
@cReportTitle VARCHAR(200),
@cCriteria1 VARCHAR(200),
@cCriteria VARCHAR(200),
@cFrom VARCHAR(25),
@cTo VARCHAR(25),
@dDateFrom VARCHAR(10),
@dDateTo VARCHAR(10),
@cCompID VARCHAR(10),
@cFilter VARCHAR(30)
as
declare @cSQL VARCHAR(200),
@cSQL1 VARCHAR(200),
@cmd VARCHAR(8000),
@cmd1 VARCHAR(8000),
@cTempTable varchar (50),
@cTempTable1 varchar (50),
@nInterval VARCHAR(3),
@nCurrent INTEGER,
@nInterval1 varchar(3),
@nInterval2 varchar(3),
@nInterval3 varchar(3),
@nInterval4 varchar(3),
@nInterval5 varchar(3),
@dd INTEGER,
@cValue1 VARCHAR(100),
@cValue2 VARCHAR(100),
@cValue3 VARCHAR(100),
@cValue4 VARCHAR(100),
@cValue5 VARCHAR(100)
set @nInterval = 30
set @nInterval1 = cast(@nInterval * 1 as varchar(3))
set @nInterval2 = cast(@nInterval * 2 as varchar(3))
set @nInterval3 = cast(@nInterval * 3 as varchar(3))
set @nInterval4 = cast(@nInterval * 4 as varchar(3))
set @nInterval5 = cast(@nInterval * 5 as varchar(3))
SET @cValue1 = CONVERT(VARCHAR(10),1,110) + ' - ' + CONVERT(VARCHAR(10),@nInterval1,110) + ' Days'
SET @cValue2 = CONVERT(VARCHAR(10),@nInterval1 + 1,110) + ' - ' + CONVERT(VARCHAR(10),@nInterval2,110) + ' Days'
SET @cValue3 = CONVERT(VARCHAR(10),@nInterval2 + 1,110) + ' - ' + CONVERT(VARCHAR(10),@nInterval3,110) + ' Days'
SET @cValue4 = CONVERT(VARCHAR(10),@nInterval3 + 1,110) + ' - ' + CONVERT(VARCHAR(10),@nInterval4,110) + ' Days'
SET @cValue5 = 'Above ' + CONVERT(VARCHAR(10),@nInterval4,110) + ' Days'
create table ##Interval
(
cCompID varchar(20),
nOrder int,
cInterval varchar(20),
cCode varchar(20)
)
---------------------------
--get all the clients
---------------------------
SELECT * INTO ##temp1 FROM
(
select cCode from client_customer where cCode = @cFrom union all
select cGroupCode from client_customer where cCode = @cFrom union all
select cBillingCompany from client_customer where cCode = @cFrom union all
select cArea from client_customer where cCode = @cFrom
)a
---------------------------
--determining the balance of the invoices
---------------------------
SELECT * INTO ##temp2 FROM
(
(
select a.cCompanyID, a.cInvNo, sum(a.nGross) as nSales, 0 as nPaid, 0 as nDebit, 0 as nCredit, 0 as nReturns
from sales a
where a.lCancelled = 0 and a.cPayType<>'Cash'
and a.cCode in (select * FROM ##temp1) --get all the clients
and a.cCompanyID = @cCompID
group by a.cCompanyID, a.cInvNo
)
union all
(
select a.cCompanyID, a.cInvNo, 0 as nSales, sum(a.nApplied) as nPaid, 0 as nDebit, 0 as nCredit, 0 as nReturns
from pr_t a
left outer join pr b on a.cTranNo = b.cTranNo and a.cCompanyID = b.cCompanyID
left outer join sales c on a.cInvNo = c.cInvNo and a.cCompanyID = c.cCompanyID
where b.lCancelled = 0
and c.cCode in (select * FROM ##temp1) --get all the clients
and a.cCompanyID = @cCompID
group by a.cCompanyID, a.cInvNo
)
union all
(
select a.cCompanyID, a.cInvNo, 0 as nSales, 0 as nPaid, sum(a.nDebit) as nDebit, 0 as nCredit, 0 as nReturns
from ar_t a
left outer join ar b on a.cTranNo = b.cTranNo and a.cCompanyID = b.cCompanyID
where b.cType = 'Debit' and b.lCancelled = 0 and b.lApproved = 1
and b.cCode in (select * FROM ##temp1) --get all the clients
and a.cCompanyID = @cCompID
group by a.cCompanyID, a.cInvNo
)
union all
(
select a.cCompanyID, a.cInvNo, 0 as nSales, 0 as nPaid, 0 as nDebit, sum(a.nCredit) as nCredit, 0 as nReturns
from ar_t a
left outer join ar b on a.cTranNo = b.cTranNo and a.cCompanyID = b.cCompanyID
where b.cType = 'Credit' and b.lSalesReturn = 0 and b.lCancelled = 0 and b.lApproved = 1
and b.cCode in (select * FROM ##temp1) --get all the clients
and a.cCompanyID = @cCompID
group by a.cCompanyID, a.cInvNo
)
union all
(
select a.cCompanyID, a.cInvNo,
0 as nSales, 0 as nPaid, 0 as nDebit, 0 as nCredit, sum(a.nCredit) as nReturns
from ar_t a
left outer join ar b on a.cTranNo = b.cTranNo and a.cCompanyID = b.cCompanyID
where b.cType = 'Credit' and b.lSalesReturn = 1 and b.lCancelled = 0 and b.lApproved = 1
and b.cCode in (select * FROM ##temp1) --get all the clients
and a.cCompanyID = @cCompID
group by a.cCompanyID, a.cInvNo
)
)a
-----------------------
--main script for creating the temp ##AR
-----------------------
select a.*, b.cRefNo, b.dRefDate, b.nBeg, b.nEnd, b.nConsumed, b.nConsumedKG, b.nPrice, b.nAmount, b.nVat, b.nWHT, b.nNet,
case when a.nDue <=0 then 'Current'
when a.nDue > 0 and a.nDue <= @nInterval1 then @cValue1
when a.nDue > @nInterval1 and a.nDue <= @nInterval2 then @cValue2
when a.nDue > @nInterval2 and a.nDue <= @nInterval3 then @cValue3
when a.nDue > @nInterval3 and a.nDue <= @nInterval4 then @cValue4
when a.nDue > @nInterval4 then @cValue5
end as cInterval,b.cTenantName into ##AR
from
(
select a.cCompanyID, b.cCode, a.cInvNo, (isnull(sum(a.nSales), 0) - isnull(sum(a.nPaid), 0) + isnull(sum(a.nDebit), 0) - isnull(sum(a.nCredit), 0) - isnull(sum(a.nReturns), 0)) as nBalance,
b.dDate, b.cSMan, b.nGross, b.cTerm, c.cValue, (cast((cast(convert(varchar(20),getdate(),101) as datetime) - b.dDate) as integer) - cast(c.cValue as integer)) as nDue, dateadd(d,cast(c.cValue as integer),b.dDate) as dDueDate
from
(
select * FROM ##temp2 --determining the balance of the invoices
) a
left outer join sales b on a.cInvNo = b.cInvNo and a.cCompanyID = b.cCompanyID
left outer join parameter_user c on b.cTerm = c.cParamName and c.cType = 'TERMS'
where b.cCode in (select * FROM ##temp1) --get all the clients
and a.cCompanyID = @cCompID
group by a.cCompanyID, b.cCode, a.cInvNo, b.dDate, b.cSMan, b.nGross, b.cTerm, c.cValue
having (isnull(sum(a.nSales), 0) - isnull(sum(a.nPaid), 0) + isnull(sum(a.nDebit), 0) - isnull(sum(a.nCredit), 0) - isnull(sum(a.nReturns), 0)) > 0
)a
left outer join
(
select a.cCompanyID, a.cInvNo, b.cRefNo, d.dDate as dRefDate,
case when a.cType = 'Meter' then b.nMeterIn
when a.cType = 'Weight' then b.nWeightOut
else 0 end as nBeg,
case when a.cType = 'Meter' then b.nMeterOut
when a.cType = 'Weight' then b.nWeightIn
else 0 end as nEnd, b.nConsumed,
case when a.cType = 'Meter' then b.nConsumedKG
when a.cType = 'Weight' then (b.nWeightOut - b.nWeightIn)
else 0 end as nConsumedKG, b.nPrice, (b.nAmount / 1.12) as nAmount,
(b.nAmount - (b.nAmount / 1.12)) as nVat,
(CASE WHEN e.lEWT=1 THEN ((b.nAmount / 1.12) * e.nEWT/100) ELSE 0 END ) as nWHT, b.nAmount as nNet,f.cTenantName
from sales a left outer join sales_t b on a.cInvNo = b.cInvNo and a.cCompanyID = b.cCompanyID
left outer join item c on b.cItemNo = c.cItemNo and a.cCompanyID = c.cCompanyID
left outer join dr d on d.cDRNo = b.cRefNo
left outer JOIN CLIENT_CUSTOMER e ON a.cCode = e.cCode
left outer JOIN METER_READING_T f ON b.cMRNo = f.cTransNo AND b.nMeterIn = f.nMeterIn
where c.cType <> 'CYLINDER' and a.cType <> 'Invoice' and a.cCode in (select * FROM ##temp1) --get all the clients
and a.cCompanyID = @cCompID
union all
select a.cCompanyID, a.cInvNo, d.cDRNo as cRefNo, d.dDate as dRefDate, 0 as nBeg,
0 as nEnd, b.nConsumed, 0 as nConsumedKG, b.nPrice, b.nAmount, 0 as nVat, 0 as nWHT, 0 as nNet,'' as cTenantName
from sales a left outer join sales_t b on a.cInvNo = b.cInvNo and a.cCompanyID = b.cCompanyID
left outer join item c on b.cItemNo = c.cItemNo and a.cCompanyID = c.cCompanyID
left outer join dr d on a.cInvNo = d.cInvNo
where c.cType <> 'CYLINDER' and a.cType = 'Invoice' and d.cDRNo is null and a.cCode in (select * FROM ##temp1) --get all the clients
and a.cCompanyID = @cCompID
)b on a.cInvNo = b.cInvNo and a.cCompanyID = b.cCompanyID
-----------------------
--main script for creating the temp ##Interval
-----------------------
insert into ##Interval
select distinct @cCompID, 1, 'Above 120 Days', cCode from ##AR
insert into ##Interval
select distinct @cCompID, 2, '91 - 120 Days', cCode from ##AR
insert into ##Interval
select distinct @cCompID, 3, '61 - 90 Days', cCode from ##AR
insert into ##Interval
select distinct @cCompID, 4, '31 - 60 Days', cCode from ##AR
insert into ##Interval
select distinct @cCompID, 5, '1 - 30 Days', cCode from ##AR
insert into ##Interval
select distinct @cCompID, 6, 'Current', cCode from ##AR
--------------------------------------
--displaying the result
--------------------------------------
select a.nOrder, a.cInterval, a.cCode, c.cName, (c.cFirstName + ' ' + case when isnull(c.cMiddleInitial,'')='' then '' else c.cMiddleInitial + ' ' end + c.cLastName) as cCustomerName, (case when isnull(c.cBusinessName,'')='' then c.cName else c.cBusinessName end) as cBusinessName,
c.cAddress, c.cLastName, c.cJobTitle, d.cCompanyName, d.cAddress1, d.cAddress2, d.cPhone, d.cfax, d.cEmail, c.cTerm, b.cInvNo, b.nBalance, b.dDate, b.nGross, b.cRefNo, b.dRefDate, b.nBeg, b.nEnd, b.nConsumed, b.nCOnsumedKG,
b.nPrice, b.nAmount, b.nVat, b.nWHT, b.nNet, isnull(e.nTotalPDC,0) as nTotalPDC, f.nTotalAR, f.nTotalPastDue, c.nLimit, @dDateFrom as dStartDate, @dDateTo as dEndDate,--g.cTenantName,
b.cTenantName,(CASE WHEN @cFilter = 'Show Note' THEN 1 ELSE 0 END) AS lNote
from ##Interval a
left outer join ##AR b on a.cInterval = b.cInterval and a.cCode = b.cCode
left outer join client_customer c on a.cCode = c.cCode
left outer join company d on a.cCompID = d.cCompanyID
left outer join
(
select a.cCode, sum(a.nAmount) as nTotalPDC
from checks a
where a.lDeposited=0 and a.cTransType = 'COL' and a.cCode = @cFrom and a.cCompanyID = @cCompID
group by a.cCode
)e on a.cCode=e.cCode
left outer join
(
--select a.cCode, sum(a.nBalance) as nTotalAR, sum(case when a.cInterval <> 'Current' then isnull(a.nBalance,0) else 0 end) as nTotalPastDue
--from ##AR a
--group by a.cCode
SELECT a.cCode,SUM(nTotalAR) AS nTotalAR,SUM(nTotalPastDue) AS nTotalPastDue
FROM
(select distinct a.cCode, (a.nBalance) as nTotalAR,
(case when a.cInterval <> 'Current' then isnull(a.nBalance,0) else 0 end) as nTotalPastDue
from ##AR a) a
GROUP BY a.cCode
)f on a.cCode=f.cCode
order by a.nOrder, a.cCode
drop table ##temp1
drop table ##temp2
drop table ##Interval
drop table ##AR
/*
select * from ##temp1
select * from ##temp2
select * from ##Interval
select * from ##AR
*/
sql server 总是将错误指向这一行
--------------------------------------
--displaying the result
--------------------------------------
select a.nOrder, a.cInterval, a.cCode, c.cName, (c.cFirstName + ' ' + case when isnull(c.cMiddleInitial,'')='' then '' else c.cMiddleInitial + ' ' end + c.cLastName) as cCustomerName, (case when isnull(c.cBusinessName,'')='' then c.cName else c.cBusinessName end) as cBusinessName,
c.cAddress, c.cLastName, c.cJobTitle, d.cCompanyName, d.cAddress1, d.cAddress2, d.cPhone, d.cfax, d.cEmail, c.cTerm, b.cInvNo, b.nBalance, b.dDate, b.nGross, b.cRefNo, b.dRefDate, b.nBeg, b.nEnd, b.nConsumed, b.nCOnsumedKG,
b.nPrice, b.nAmount, b.nVat, b.nWHT, b.nNet, isnull(e.nTotalPDC,0) as nTotalPDC, f.nTotalAR, f.nTotalPastDue, c.nLimit, @dDateFrom as dStartDate, @dDateTo as dEndDate,--g.cTenantName,
b.cTenantName,(CASE WHEN @cFilter = 'Show Note' THEN 1 ELSE 0 END) AS lNote
最佳答案
当您比较/聚合具有不同排序规则的列时,您必须使用 COLLATE
将其中至少一个排序规则与您想要的排序规则保持一致。表达。例如,假设您有一个列 c1
有排序规则Latin1_General_CI_AI
在表中Table1
和一列c2
有排序规则SQL_Latin1_General_CP1_CI_AS
在表中Table2
并且您想将两者结合起来:
SELECT c1 COLLATE SQL_Latin1_General_CP1_CI_AS
FROM Table1
UNION ALL
SELECT c2
FROM Table2;
关于sql - 排序规则冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3800520/
我需要在 nginx-ingress 版本上允许来自多个来源的请求:http://localhost:4200、http://localhost:4242 等1.7.1.但我无法对多个来源执行此操作,
我正在部署我使用 APIGILITY 开发的 API到 IIS。由于 IIS 不支持 .htaccess,我试图从 .htaccess 文件的内容创建 web.config 文件。我使用 IISv7.
我正在尝试更改上面 css 样式中的“宽度”规则。在“inspect element”中你可以看到宽度是1008px。我不希望它是 1008px 但它不会让我在 css 样式中更改它你可以看到它被“删
外部css赋值有2种方法,我用的是第一种;大多数网站使用第二种方法。我想知道我是否做错了! 第一种方法: 为几乎每个 css 规则创建一个类并在任何地方使用它们。 blah blah .f_
RDF使用 WEB 标识符 (URIs) 来标识资源,使用属性和属性值来描述资源 RDF 资源、属性和属性值 RDF使用 WEB 标识符来标识事物,并通过属性和属性值来描述资源。 关于资源、属性
我想挖掘特定的 rhs 规则。文档中有一个示例证明这是可能的,但仅适用于特定情况(如下所示)。先来一个数据集来说明我的问题: input {b=100002} 0.2500000 0.250000
我想让 nginx 从网站根目录(:http://localhost:8080/)提供一个静态文件,但它为我的代理通行证提供服务;它提供“/”规则而不是“=/”。 这是我的 nginx 配置的样子:
根据gnu make documentation , 如果一个规则通过一次调用生成多个目标(例如,一个配方执行一个带有多个输出文件的工具),你可以使用 '&:' 规则语法来告诉 make。但是,当在多
我已阅读Firebase Documentation并且不明白什么是 .contains()。 以下是文档中 Firebase 数据库的示例规则: { "rules": { "rooms"
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 6 年前。 Improv
我正在尝试做一些多态性练习,但我无法弄清楚这种多态性是如何工作的。我没有找到任何关于这种练习的深入信息。希望大家能给我一些解释。 练习1: class Top { public void m(
为了调试复杂的 XSLT 转换,我将其分为几个部分:首先构建 %.1.xml,然后使用它构建 %.2.xml ,最后构建 %.3.xml。一切正常,但如果我要求 Make 构建最后一个,Make 总是
我尝试了 hacerrank 的 slove 练习 Click我不知道如何添加这些规则: ► 它可以包含 4 个一组的数字,并用一个连字符“-”分隔。 ► 不得有 4 个或更多连续重复数字。 这是我的
我正在尝试编写一个小测验,我希望“再试一次”按钮遵循与“else”之前的“if”语句相同的规则 using System; public class Program { public stat
在我的 Spring/Boot Java 项目中,我有一组服务方法,例如以下一个: @Override public Decision create(String name, String descr
我正在阅读 Covariant virtual function .上面写着 假设 B::f 覆盖了虚函数 A::f。如果满足以下所有条件,A::f 和 B::f 的返回类型可能不同: 1) The
我工作的公司想要分发(在公共(public)链接中)具有内部签名的应用程序。我很确定 Apple 否认这种事情,但我在官方文档/契约(Contract)中没有找到任何相关信息。 有谁知道它到底是如何工
我是 CSS 新手。我观察到一个奇怪的 CSS 行为,其中一个元素具有以下 CSS 属性 .container .header{ color: #FFFFFF; font-size: 2em;
这个问题在这里已经有了答案: Is there a CSS selector for elements containing certain text? (21 个答案) 关闭 7 年前。
我有以下 CSS: workoutcal.css: .errorlist{ color:red; } 以下基本模板: base.html: {% load static %} {
我是一名优秀的程序员,十分优秀!