Hello,
I am having a nightmare of a time getting a caertain sql query to work
this is the statement...
SELECT USERINFO.USERNAME, OPPORTUNITY.DESCRIPTION, OPPORTUNITY.SALESPOTENTIAL, OPPORTUNITY.CLOSEPROBABILITY, OPPORTUNITY.ESTIMATEDCLOSE, PY3_OPPORTUNITY.EST_ORDER, PY3_OPPORTUNITY.MARGIN, ACCOUNT.ACCOUNT, USERINFO.DIVISION
FROM { oj ((Saleslogix.sysdba.OPPORTUNITY OPPORTUNITY LEFT OUTER JOIN Saleslogix.sysdba.ACCOUNT ACCOUNT ON OPPORTUNITY.ACCOUNTID = ACCOUNT.ACCOUNTID) LEFT OUTER JOIN Saleslogix.sysdba.USERINFO USERINFO ON OPPORTUNITY.ACCOUNTMANAGERID = USERINFO.USERID) LEFT OUTER JOIN Saleslogix.sysdba.PY3_OPPORTUNITY PY3_OPPORTUNITY ON OPPORTUNITY.OPPORTUNITYID = PY3_OPPORTUNITY.OPPORTUNITYID}
WHERE userinfo.username = "Petrona O'Neill" AND (OPPORTUNITY.CLOSEPROBABILITY >= 10 AND OPPORTUNITY.CLOSEPROBABILITY <= 90) AND OPPORTUNITY.ESTIMATEDCLOSE >= CONVERT(smalldatetime, '"+Request.Form("fromdate"+"', 103) AND OPPORTUNITY.ESTIMATEDCLOSE <= CONVERT(smalldatetime, '"+Request.Form("todate"+"', 103)
ORDER BY OPPORTUNITY.ESTIMATEDCLOSE ASC
The problem is here> WHERE userinfo.username = "Petrona O'Neill"
The apostrophe in the name is causing an error.
Please can somebody tell me how to write that part of the statement to get it to work properly.
Thanks
I am having a nightmare of a time getting a caertain sql query to work
this is the statement...
SELECT USERINFO.USERNAME, OPPORTUNITY.DESCRIPTION, OPPORTUNITY.SALESPOTENTIAL, OPPORTUNITY.CLOSEPROBABILITY, OPPORTUNITY.ESTIMATEDCLOSE, PY3_OPPORTUNITY.EST_ORDER, PY3_OPPORTUNITY.MARGIN, ACCOUNT.ACCOUNT, USERINFO.DIVISION
FROM { oj ((Saleslogix.sysdba.OPPORTUNITY OPPORTUNITY LEFT OUTER JOIN Saleslogix.sysdba.ACCOUNT ACCOUNT ON OPPORTUNITY.ACCOUNTID = ACCOUNT.ACCOUNTID) LEFT OUTER JOIN Saleslogix.sysdba.USERINFO USERINFO ON OPPORTUNITY.ACCOUNTMANAGERID = USERINFO.USERID) LEFT OUTER JOIN Saleslogix.sysdba.PY3_OPPORTUNITY PY3_OPPORTUNITY ON OPPORTUNITY.OPPORTUNITYID = PY3_OPPORTUNITY.OPPORTUNITYID}
WHERE userinfo.username = "Petrona O'Neill" AND (OPPORTUNITY.CLOSEPROBABILITY >= 10 AND OPPORTUNITY.CLOSEPROBABILITY <= 90) AND OPPORTUNITY.ESTIMATEDCLOSE >= CONVERT(smalldatetime, '"+Request.Form("fromdate"+"', 103) AND OPPORTUNITY.ESTIMATEDCLOSE <= CONVERT(smalldatetime, '"+Request.Form("todate"+"', 103)
ORDER BY OPPORTUNITY.ESTIMATEDCLOSE ASC
The problem is here> WHERE userinfo.username = "Petrona O'Neill"
The apostrophe in the name is causing an error.
Please can somebody tell me how to write that part of the statement to get it to work properly.
Thanks