Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6740435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:36:20+00:00 2026-05-26T11:36:20+00:00

I have a problem with a certain query given to me and I don’t

  • 0

I have a problem with a certain query given to me and I don’t know how to solve that problem.. here is the query..

  SELECT dcm.code DCM_No, 
         dcm.datetime_created DCM_Date,  
         lne.seq_number,
         par.code,
         par.description particular,
         ft.description fee_type,
     lne.amount, 
         case when lne.drcr =1 then 'Debit' else 'Credit' end DrCr,  

         case when isnull(dcm.is_sd,'N') = 'Y' then 'Salary Deduction' else null end is_sd,   
         org.description Company,
         org.postal_address company_addr,
         'S.Y. ' + substring(sy.school_year,1,4)+'-'+substring(sy.school_year,5,4) +' '+sem.description SY,
         entity_a.code + ' - ' + coalesce(entity_a.stud_lname,'') +', '+coalesce(entity_a.stud_fname,'') +' '+coalesce(entity_a.stud_mname,'') Student,

     case when   isnull(dm.description2,'') = '' then 
              crs.course_short_name + '-'+convert(char(1),entity_a.stud_grade)
        else    crs2.course_short_name + '-'+convert(char(1),reg.stud_grade) end as Course,
         isnull(dm.description2,'Not Enrolled')

    FROM  es.lib_rgn_students entity_a
        left join  ars.ars_dcm dcm on dcm.entity_id = entity_a.id
         LEFT JOIN afs.entity entity_b ON dcm.prepared_by_id = entity_b.id 
         LEFT JOIN ua.user_account ON dcm.prepared_by_id = ua.user_account.id
         left join ars.ars_dcm_line lne on lne.ars_dcm_id = dcm.id
         left join es.lib_fin_fees_master par on par.id = lne.ars_particular_id
         left join es.lib_fin_feetype ft on ft.code = lne.fee_code
        left join es.stp_sysem sy on sy.id = dcm.period_id
         inner join es.stp_semesterms sem on sem.code = sy.semester and sem.trimester = 0
         inner join afs.organization org on org.id = sy.company_id
         inner join es.lib_crs crs on crs.id = entity_a.course_id
         left join es.trn_rgn_reg_hdr reg on reg.period = sy.id and reg.stud_id = :as_studid
         left join document_status_map dm on dm.code = reg.document_status
         left join es.lib_crs crs2 on crs2.id = reg.course_id

   WHERE 
         (dcm.entity_id = :as_studid ) AND  
         ( dcm.period_id = :as_period ) AND  
         ( dcm.document_status_code not in(2,3) )    

and I have this error:

Incorrect syntax near ‘:’.

pls help i am not good with this 🙁

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:36:21+00:00Added an answer on May 26, 2026 at 11:36 am

    The :as_studid and :as_period things are most likely parameters of this query as used by some client software. Before the query is actually executed, the :name bits are replaced (typically by some middle-tier software) with something like @P1 or, maybe, @as_studid, so the server never sees the colons there (and never complains).

    If you are not a client software developer and have simply been assigned the task of doing something with the query, then you need to apply the above mentioned transformations manually. I’d suggest you declared variables @as_studid and @as_period and use them instead of :as_studid and :as_period respectively. Also you’d probably need to assign them some values, so you could see some results when running the query. Here’s an example of how the modified script might look like:

    DECLARE
      @as_studid int,
      @as_period int;  /* those are just my guesses, the actual types
                          might need to be something other than int */
    
    SET @as_studid = 10;
    SET @as_period = 20; /* again, those are arbitrary values off the top
                            of my head but you might have to discover some
                            real ones before going on */
    
    SELECT dcm.code DCM_No, 
           dcm.datetime_created DCM_Date,  
           lne.seq_number,
           par.code,
           par.description particular,
           ft.description fee_type,
       lne.amount, 
           case when lne.drcr =1 then 'Debit' else 'Credit' end DrCr,  
    
           case when isnull(dcm.is_sd,'N') = 'Y' then 'Salary Deduction' else null end is_sd,   
           org.description Company,
           org.postal_address company_addr,
           'S.Y. ' + substring(sy.school_year,1,4)+'-'+substring(sy.school_year,5,4) +' '+sem.description SY,
           entity_a.code + ' - ' + coalesce(entity_a.stud_lname,'') +', '+coalesce(entity_a.stud_fname,'') +' '+coalesce(entity_a.stud_mname,'') Student,
    
       case when   isnull(dm.description2,'') = '' then 
                crs.course_short_name + '-'+convert(char(1),entity_a.stud_grade)
          else    crs2.course_short_name + '-'+convert(char(1),reg.stud_grade) end as Course,
           isnull(dm.description2,'Not Enrolled')
    
      FROM  es.lib_rgn_students entity_a
          left join  ars.ars_dcm dcm on dcm.entity_id = entity_a.id
           LEFT JOIN afs.entity entity_b ON dcm.prepared_by_id = entity_b.id 
           LEFT JOIN ua.user_account ON dcm.prepared_by_id = ua.user_account.id
           left join ars.ars_dcm_line lne on lne.ars_dcm_id = dcm.id
           left join es.lib_fin_fees_master par on par.id = lne.ars_particular_id
           left join es.lib_fin_feetype ft on ft.code = lne.fee_code
          left join es.stp_sysem sy on sy.id = dcm.period_id
           inner join es.stp_semesterms sem on sem.code = sy.semester and sem.trimester = 0
           inner join afs.organization org on org.id = sy.company_id
           inner join es.lib_crs crs on crs.id = entity_a.course_id
           left join es.trn_rgn_reg_hdr reg on reg.period = sy.id and reg.stud_id = :as_studid
           left join document_status_map dm on dm.code = reg.document_status
           left join es.lib_crs crs2 on crs2.id = reg.course_id
    
     WHERE 
           (dcm.entity_id = @as_studid ) AND   -- the vars declared above are used
           ( dcm.period_id = @as_period ) AND  -- here instead of the ':'-bits
           ( dcm.document_status_code not in(2,3) )
    

    Alternatively you could do without variables, just replace :as_studid and :as_period with some (real) values. But that way you’d have to remember what exactly was parametrised in the original query, for, in any event, if your task was to modify the query itself, you might have to submit it back with the :-names, just like you received it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that retrieves location entities within a certain radius given a
Here's a problem. Developers have some kind of a task (develop certain feature), which
I have a problem when trying to insert certain characters through query with parameters.
I have a query that attempts to select cases/clients (clients.id) based on multiple conditions
I might have oversimplified my problem here: How to use MAX in MySQL? Given
I have a query that I run once a day that takes certain tables
I have a problem positioning an element in certain browsers. I'm using the jQuery
I have problem in some JavaScript that I am writing where the Switch statement
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem with fancybox. I want to write a function that will run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.