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.
Author |
Topic |
Lloyd
Starting Member
1 Post |
Posted - 2013-03-25 : 15:20:37
|
Hello,I am getting a syntax error when trying to add a parameter after my dynamic sql code, within the query designer in ssrs. the syntax error is on the '+' before my @ReportList. how do I fix this syntax error?my code is:exec('select M.MDSITENAME, P.lastname +'', ''+ p.firstname +'' (''+p.MedRecNumber+'')'' as PatientName , c.entrydate, tr.TransactionTypeabbreviation+'' ''+cast(c.TransactionAmount as varchar) as TransType, f.billnum, f.commonName+'' ''+f.strength+'' ''+'' ''+f.uom+'' ''+f.form as DrugName, o.lastname +'', ''+ o.firstname as OperatorName, w.LastName +'', ''+w.FirstName AS WitnessNamefrom T_CHARGE c inner join T_PATIENT p on p.PatientID = c.patientid and p.siteid = c.siteidinner join T_Operator o on o.operatorid = c.OperatorID and o.siteid = c.siteidleft join T_OPERATOR AS w ON c.WitnessID = w.OperatorID and c.siteid = w.siteidinner join T_FORMULARY f on f.formularyid = c.formularyid and f.siteid = c.siteidinner join T_TRANSACTION_TYPE tr on tr.TransactionTypeID = c.TransactionType inner join T_STATION s on s.stationid = c.stationid and s.siteid = c.siteidinner join t_mdsite m on m.mdsiteid = c.siteidwhere c.entrydate >= '''+@StartDate+''' and c.entrydate < dateadd(day,1,'''+@EndDate+'''AND m.activesite = 1 and ') +@ReportList |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-03-26 : 14:41:46
|
whats command type selected? you dont need dynamic sql. just choose type of text and use above query after removing inner 's------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|