This is the T-SQL I scraped out of a Crystal Report that worked until 4pm
today:
When I run the following:
SELECT "Account"."OpenDt", "CustRelation"."RelationCode",
"CustRelation"."FullName", "Userfield"."UDFCuthr5", "Userfield"."UDFCufiv1",
"Userfield"."UDFCufiv2", "Account"."AcctId", "CustRelation"."Sequence",
"Account"."OpenedById_CustLoginId", "ViewSessionEvents"."OpenDt",
"ViewSessionEvents"."AcctId", "ViewSessionEvents"."ProdId",
"ViewSessionEvents"."EventStatus", "ViewSessionEvents"."EventCode",
"ViewSessionEvents"."EventTime", "SalesSession"."BranchID",
"Customer"."EvePhone", "Customer"."DayPhone"
FROM ((((("CBSDesktop"."dbo"."ViewSessionEvents" "ViewSessionEvents"
INNER JOIN "CBSDesktop"."dbo"."Account" "Account" ON
"ViewSessionEvents"."AcctId"="Account"."AcctId") INNER JOIN
"CBSDesktop"."dbo"."SalesSession" "SalesSession" ON
"ViewSessionEvents"."SalesSessionId"="SalesSession"."SalesSessionID") INNER
JOIN "CBSDesktop"."dbo"."CustRelation" "CustRelation" ON
("Account"."AccountID"="CustRelation"."AccountId") AND
("Account"."PrimCustId_CustPermId"="CustRelation"."CustPermId")) INNER JOIN
"CBSDesktop"."dbo"."Person" "Person" ON
"CustRelation"."CustPermId"="Person"."CustPermId") INNER JOIN
"CBSDesktop"."dbo"."Userfield" "Userfield" ON
"Person"."PersonID"="Userfield"."CustomerId") INNER JOIN
"CBSDesktop"."dbo"."Customer" "Customer" ON
"Userfield"."CustomerId"="Customer"."CustomerID"
WHERE "ViewSessionEvents"."EventCode"=N'ACCTADD' AND
"ViewSessionEvents"."EventStatus"=N'Complete' AND
"ViewSessionEvents"."AcctId"<>N'null' AND
("CustRelation"."RelationCode"=N'JAF' OR "CustRelation"."RelationCode"=N'JOF
'
OR "CustRelation"."RelationCode"=N'OWN' OR
"CustRelation"."RelationCode"=N'SOW') AND
("ViewSessionEvents"."EventTime">={ts '2005-10-02 00:00:00'} AND
"ViewSessionEvents"."EventTime"<{ts '2005-10-09 00:00:00'}) AND NOT
("ViewSessionEvents"."ProdId"=N'546126' OR
"ViewSessionEvents"."ProdId"=N'587403' OR
"ViewSessionEvents"."ProdId"=N'987001')
ORDER BY "SalesSession"."BranchID", "Account"."OpenedById_CustLoginId",
"Account"."OpenDt", "Account"."AcctId", "CustRelation"."Sequence"
I get:
Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the
subquery follows =, !, <, <=, >, =>, or when the subquery is used as an
expression"Pancho" <Pancho@.discussions.microsoft.com> wrote in message
news:A2D04ADB-523A-4B82-9D99-BB81292EA90F@.microsoft.com...
> This is the T-SQL I scraped out of a Crystal Report that worked until 4pm
> today:
> . . .
When rows were added causing a subquery which previously returned a single
row to return more than one value:
Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the
subquery follows =, !, <, <=, >, =>, or when the subquery is used as an
expression
It this query appears to lack subqueries, but there could be some in the
views on which it's based.
David
Showing posts with label t-sql. Show all posts
Showing posts with label t-sql. Show all posts
Subscribe to:
Posts (Atom)