Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Expression Error

Status
Not open for further replies.

Me2500

Programmer
Aug 3, 2007
7
US
Crystal XI with an SQL Server Database 2005 (JobBoss)

SELECT 'Tax_Code_Detail'.'Rate'
FROM 'Tax_Code_Detail'
WHERE 'Tax_Code_Detail'.'Tax_Code' = 'NC TAX'

or

SELECT "Tax_Code_Detail"."Rate"
FROM "Tax_Code_Detail"
WHERE "Tax_Code_Detail"."Tax_Code" = 'NC TAX'

The first bit of code comes from pulling the fields directly from the database fields box. I get an error:

"Incorrect Syntax Near Keyword 'Select' "

For the life of me I can't figure out what is wrong. Any suggestions?

I want to expand the code into


SELECT 'Tax_Code_Detail.Rate'
FROM 'Tax_Code_Detail'
WHERE 'Tax_Code_Detail.Tax_Code' = {fn RIGHT({fn RTRIM("vwShippingLog_pn_s"."Destination")},2 )}

I'm hoping that if I get the first part the second part will come easy.
 
Select statements have to be enclosed in parens and they must return only one value (or at least one per group). If this latter is true, then try:

(
SELECT 'Tax_Code_Detail.Rate'
FROM 'Tax_Code_Detail'
WHERE 'Tax_Code_Detail.Tax_Code' = {fn RIGHT({fn RTRIM("vwShippingLog_pn_s"."Destination")},2 )}
)

Otherwise, you could try the same thing in a command.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top