Re: Invalid SQL Statement



Susan Bricker <susan.l.bricker@xxxxxxxxxxxxx> wrote in
news:46fd4d45$0$500$815e3792@xxxxxxxxxxxxxx:

Hi. Does anyone have the patience and knowledge to determine
what's wrong with the following SQL statement (that is being
passed to my MAILMERGE routine)? I haven't a clue. The error
message doesn't really help. All is says is that the SQL
statement is not valid. Does it have too many characters? The
length of the statement is 1254.


Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

With such a long SQL statement,I format.

SELECT
tblDogTitles.dogtitleID,
tblDogTitles.dogregnbr,
tblDogTitles.processeddt,
tblDogTitles.multiplier,
Day(tblTrials.trialdt) & ' ' & MonthName(Month(tblTrials.trialdt)) &
' ' & Year(tblTrials.trialdt) AS outtrialdt,
tblTitles.title,
tblTitles.titleabbrev,
tblDogs.formalname,
tblPeople.fname & (''+tblPeople.midinit+'.') & ' ' &
tblPeople.lname & (' '+tblPeople.suffix+'.') AS owner,
tblPeople.altperson AS altowner,
IIF(titleabbrev = 'UDX-H' OR titleabbrev = 'OTCH-H',' ',' ' &
tblClasses.class & ' Class ') AS classtxt,
IFF(mulitplier > 1, multiplier, ' ') AS titlesuffix,
tblUserSettings.uval

FROM
tblUserSettings,
tblTrials

INNER JOIN
(
(
(tblClasses
INNER JOIN tblTrialClass
ON tblClasses.classID = tblTrialClass.classID
)
INNER JOIN tblTitles
ON tblClasses.classID = tblTitles.classID
)
INNER JOIN
( tblPeople
INNER JOIN
(tblDogs
INNER JOIN tblDogTitles
ON tblDogs.dogregnbr = tblDogTitles.dogregnbr
)
ON tblPeople.peopleID = tblDogs.peopleID
)
ON (tblTrialClass.trialclassID = tblDogTitles.trialclassID)
AND (tblTitles.titleID = tblDogTitles.titleID)
)
ON tblTrials.trialID = tblTrialClass.trialID

WHERE (tblDogTitles.processeddt = #9/28/2007 2:42:32 PM#)
AND tblUserSettings.uvar = 'U_Coordinator'

ORDER BY
tblDogTitles.dogregnbr, tblTitles.titleID

First thing that showed up is IFF(mulitplier > 1
I suspect that you want IIF

I'm not sure about the joins in the FROM segmant.but they're
probably ok.


As to the length, no problem.



--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: SQl Data Provider Performance Issues
    ... selects with a single inner join perforn OK. ... When I run the query from SQL ... Analyzer, SQL Profiler shows a duration of 30. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SQl Data Provider Performance Issues
    ... selects with a single inner join perforn OK. ... When I run the query from SQL Query ... Analyzer, SQL Profiler shows a duration of 30. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SQl Data Provider Performance Issues
    ... Can you provide a complete sample app ... selects with a single inner join perforn OK. ... When I run the query from SQL ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: sysindexes
    ... collation, but you should be able to use it for your column change as well. ... SQL Server MVP ... DECLARE @sql VARCHAR ... INNER JOIN information_schema.table_constraints tc ...
    (microsoft.public.sqlserver.server)
  • Re: SQl Data Provider Performance Issues
    ... selects with a single inner join perforn OK. ... When I run the query from SQL Query ... Analyzer, SQL Profiler shows a duration of 30. ...
    (microsoft.public.dotnet.languages.csharp)