-
Declare @String as nVarChar(1000)
-
-
Declare @Ind as Char(1),@Com as Char(1),@BAC3 as Char(1)
-
Declare @BAC1 as Char(1),@BAC2 as Char(1),@BAC4 as Char(1)
-
Declare @current as varChar(7),@saving as varChar(6)
-
Declare @move as varChar(12),@Other as varChar(5)
-
Declare @new as varChar(3),@old as varChar(3),@back as varChar(10)
-
-
set @Ind = 'I'
-
set @Com = 'E'
-
set @BAC1 = 'C'
-
set @BAC2 = 'S'
-
set @BAC3 = 'M'
-
set @BAC4 = 'O'
-
set @current = 'Current'
-
Set @saving = 'Saving'
-
Set @move = 'Money Market'
-
SET @Other = 'Other'
-
Set @new = 'NEW'
-
Set @old = 'OLD'
-
Set @back = 'BACKORDER'
-
-
-
SET @String = 'SELECT D.TransactionType,TransactionId,T.TransactionDate,T.TransactionAmount As GrandTotal,
-
TransactionQuantity As AmtDtl,
-
TransactionConversionRate As Convrate,AC.Country As CustCtry,AP.Parish As CustPsh,AD.District AS CustDst,AM.Community As CustCom,CL.Street As CustSrt,
-
TransactionNotes,CL.Occupation,CL.TaxRegistrationNumber As Cust_Trn,AG.Firstname As AgentFname,
-
AG.LastName As AgentLname,SUBSTRING(AG.Middlename,1,1) As AgentMI,IT.EmploymentJobTitle As Title,AG.TaxRegistrationNumber As AgentTrn,
-
AG.TelephoneNumbers As AgentPhone,CL.TelephoneNumbers As CustPhone,T.BeneficiaryCustomerCode As Cust_no,TransactionNotes As SourceOfFunds,
-
AC2.Country As AgntCtry,AP2.Parish As AgntPsh,AD2.District AS AgntDst,AM2.Community As AgntCom,AG.Street As AgntSrt,CL.CustomerCode As AgentCode,
-
Cust_Org_Name =
-
CASE WHEN C.CustomerType ='+'I'+'THEN RTRIM(CL.Lastname)
-
WHEN C.CustomerType = '+'E'+'THEN RTRIM(CL.Customername)
-
END,CL.Firstname,C2.CustomerIdentificationTypeDescription As AgentID,AG.DocumentNumber As AgentDocNum,
-
T.DocumentNumber,C.CustomerIdentificationTypeDescription As ClientID,RTRIM(CurrencyAbbreviation) As CurDesc,RTRIM(InstrumentDescription) As InsDesc,TransactionTradeRate As ExRate
-
,CustKnown =
-
CASE WHEN CL.DateTimeCreated > (SELECT TOP 1 GenDateTime FROM TradeThresholdReport WHERE CompanyCode = @Company AND LocationCode = @Location AND BranchCode = @Branch ORDER BY GenDateTime DESC ) THEN'+ 'NEW'+'
-
ELSE '+'OLD'+'
-
END,BankAccountNumber
-
,AgentKnown =
-
CASE WHEN AG.DateTimeCreated > (SELECT TOP 1 GenDateTime FROM TradeThresholdReport WHERE CompanyCode = @Company AND LocationCode = @Location AND BranchCode = @Branch ORDER BY GenDateTime DESC ) THEN '+ 'NEW'+'
-
ELSE '+ 'OLD'+'
-
END,
-
AccountType =
-
CASE WHEN IB.BankAccountType = '+'C'+' THEN '+'Current'+'
-
WHEN IB.BankAccountType = '+'S'+' THEN '+'Saving'+'
-
WHEN IB.BankAccountType = '+'M'+' THEN '+'Money Market'+'
-
WHEN IB.BankAccountType = '+'O'+' THEN '+'Other'+'
-
END,Substring(Cast(T.DateTimeCreated as Char(24)),12,8) As tranTime,CL.DateOfBirth As Dob
-
FROM Customer AG RIGHT OUTER JOIN TradeTransactions T ON AG.CustomerCode = T.BeneficiaryCustomerCode
-
LEFT OUTER JOIN BankTransactionSummary BT
-
ON BT.OriginatingTransactionNumber = T.TransactionId
-
LEFT OUTER JOIN InventoryBank IB
-
ON IB.InventoryBankCode = BT.InventoryBankCode
-
,TradeTransactionsDetails D,CustomerIdentificationType C,CustomerIdentificationType C2,Customer CL,Currency CR,Instruments I,
-
SysAddressCountry AC,SysAddressCountry AC2,SysAddressParish AP,SysAddressParish AP2,SysAddressDistrict AD,SysAddressDistrict AD2,
-
SysAddressCommunity AM,SysAddressCommunity AM2,InventoryTraders IT,CustomerCategory CC
-
WHERE C.CustomerIdentificationTypeCode = IdentificationUsed AND CR. CurrencyCode = D.CurrencyCode AND Liquidity = 1
-
AND I.InstrumentCode = D.InstrumentCode AND D.CurrencyCode <> 1 AND VoidedByUser IS NULL
-
AND CL.CustomerCode = T.Customer AND T.TransactionId = TransactionNumber
-
AND I.CompanyCode = @Company And I.LocationCode = @Location AND I.BranchCode = @Branch
-
AND CR.CompanyCode = @Company And CR.LocationCode = @Location AND CR.BranchCode = @Branch
-
AND D.TransactionType <> '+'BackOrder'+' AND D.TransactionType = T.TransactionType
-
AND AC.CountryCode = CL.Country AND AP.ParishCode = CL.ParishOrState AND AD.DistrictCode = CL.DistrictOrCity AND CC.Include_In_Money_Laudering_Report = 1
-
AND AM.CommunityCode = CL.CommunityOrTownShip AND IT.TradersCode = T.TraderCode
-
AND AC2.CountryCode = AG.Country AND AP2.ParishCode = AG.ParishOrState AND AD2.DistrictCode = AG.DistrictOrCity
-
AND AM2.CommunityCode = AG.CommunityOrTownShip AND C2.CustomerIdentificationTypeCode = AG.CustomerIdentificationType AND CC.CompanyCode = @Company
-
AND T.CompanyCode = @Company AND T.LocationCode = @Location AND T.BranchCode = @Branch AND CC.CustomerCategoryCode = AG.CustomerCategory
-
AND D.CompanyCode = @Company AND D.LocationCode = @Location AND D.BranchCode = @Branch
-
order by Cust_no, trantime ASC,CurDesc'
-
--print @String
-
-
--set @String = 'Select * from TradeTransactionsDetails'
-
-
Exec(@String)
-
I am getting a syntax error at RTRIM(CL.FirstName) can some one tell me why
5 1279 ck9663 2,878
Recognized Expert Specialist
Incorrect Syntax at RTRIM copy and paste it in query and you will see the error
thanks in advance
Delerna 1,134
Recognized Expert Top Contributor
you need to put a space between the ' and the THEN
that comes just before RTRIM(CL.FirstName)
Delerna 1,134
Recognized Expert Top Contributor
you will also need to add a + char(39) + either side of I and E so that you can get the strin quote into the string
This bit
CASE WHEN C.CustomerType ='+'I'+'THEN RTRIM(CL.Lastname)
will appear in your string as
CASE WHEN C.CustomerType =ITHEN RTRIM(CL.Lastname)
where as you need it to be
CASE WHEN C.CustomerType ='I' THEN RTRIM(CL.Lastname)
so this will do it
CASE WHEN C.CustomerType =' + char(39) + 'I' + char(39) + ' THEN RTRIM(CL.Lastname)
ck9663 2,878
Recognized Expert Specialist
i'd assume delarna is right and will not paste the whole code...
also try this:
CASE WHEN C.CustomerType = '+'I'+' THEN RTRIM(CL.Lastname)
i just added space between the single-quote and equal sign and another space between single-quote and THEN...
-- ck
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Steve |
last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone
can explain to me why it was reported that way.
...
|
by: Donald Canton |
last post by:
Hi,
I'm using Bjarne's book to learn C++ and am stuck on the Calc program
in Section 6. Everything works fine except when I try to use
istringstream to parse a token from the command line. I...
|
by: r.nikhilk |
last post by:
Hi,
Currently, we are porting C++ applications from 32 bit to 64 bit on AIX
platform. (The current version of AIX is 5.3 and xlC verison is 8.0).
We are able to compile the applications by...
|
by: david |
last post by:
Anyone could give me a hand about this syntax error? Thank you.
David
Source Code:
Dim conn As New SqlConnection(strConn)
Dim daAngio As New SqlDataAdapter(strSelectStatement, conn)
'Create a...
|
by: Manuel |
last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using
devc++.
So I've imported the glut32.dsp into devc++, included manually some
headers, and start to compile.
It return a very...
| |
by: Hari Sekhon |
last post by:
I've written an except hook into a script as shown below which works
well for the most part and catches exceptions.
import sys
def myexcepthook(type,value,tb):
do something
...
|
by: Josh |
last post by:
I have a lot of except Exception, e statements in my code, which poses some
problems. One of the biggest is whenever I refactor even the triviallest
thing in my code.
I would like python to...
|
by: bryant |
last post by:
Hi all.
I am new to ASP and working in Expression Web. The following query
displays the information I need in the gridview for a single record.
SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
|
by: muby |
last post by:
Hi everybody :)
I'm modifying a C++ code in VC++ 2005
my code snippet
void BandwidthAllocationScheduler::insert(
Message* msg,
BOOL* QueueIsFull,
|
by: Banfa |
last post by:
So I have a little problem, I have a template class and that class contains a template function; now what I want to do is declare that function in the class (or indeed the entire class) as a friend...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |