Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select query Line 15: Incorrect syntax near ','.

Author  Topic 

reddymade
Posting Yak Master

165 Posts

Posted - 2006-03-08 : 12:59:53


I am getting tthe following error: when i run the select query
Server: Msg 170, Level 15, State 1, Line 15
Line 15: Incorrect syntax near ','.

I am doing concatenation of lot of fields to body. and using that for sending email.
Please if you can tell me what am i doi g wrong at line15.


Select rcp.Email, getdate(),
'Title: ' + rtrim((m.rmtitle) + char(13)
+'Document Date: ' + rtrim(isnull(CONVERT(varchar(10),m.DocumentDate,101),'')) + char(13)
+ 'Recv Date: ' + rtrim(isnull(CONVERT(varchar(10),m.ReceivedDate,101),'')) + char(13)
+ 'From: ' + rtrim(m.OrigSender)+ char(13)
+ 'Organization: ' + m.OrigOrganization + char(13)
+ 'To: ' +dbo.ccsFunctionRecipientTO(29,'RM') + char(13)
+ 'DistributionDate: ' + rtrim(isnull(CONVERT(varchar(10),rcp.sentdate,101),'')) + char(13) + char(13)
+ 'Module: ' + rtrim((rcp.MODULENAME) + char(13)
+ 'Program: ' + pg.progno + ' - '+ pg.progname + char(13)
+ 'Project: ' + pj.projno + ' - ' + pj.projname + char(13)
+ 'Contract: ' + ct.contractno + ' - ' + ct.contractname + char(13)
+ 'Log: ' + rtrim((ltype.englishtext) + char(13)
+ 'Sequence: ' + rtrim(isnull(m.SequenceNO,'')) + char(13)+char(13)
+ 'Created/Modified By: ' + rtrim(isnull(m.UpdatedBy,'')) + char(13) as body,
'You have been assigned distributed a document on CCSNet: Invoice '+ m.rmtitle
from TAB_ccsNetRecipients rcp, TAB_ccsNetRM m, tab_ccsnetprograms pg, tab_ccsnetprojects pj,
tab_ccsnetcontracts ct , TAB_ccsNetPickLists ltype
where rcp.ModuleRecordID = m.RMID and
m.logtype = ltype.pickid and ltype.fieldlabelkey = 'lblLogType' and
m.progid = pg.progid and
m.projid = pj.projid and
m.contractid = ct.contractid and rcp.ModuleName = 'RM' and rcp.MODULERECORDID =29


Thank you very much for the information.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-03-08 : 13:34:33
change 'Title: ' + rtrim((m.rmtitle) + char(13)
to
'Title: ' + rtrim(m.rmtitle) + char(13)

and use joins.

EDIT:
you have rtrim(( which should be rtrim( in some other places


Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -