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 8381129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:37:39+00:00 2026-06-09T16:37:39+00:00

I am trying to pull the selected values from my checkboxlist but I keep

  • 0

I am trying to pull the selected values from my checkboxlist but I keep running into an error in sql.

error

Msg 105, Level 15, State 1, Line 22
Unclosed quotation mark after the character string ')'.
Msg 102, Level 15, State 1, Line 22
Incorrect syntax near ')'.

SP

@DEPTCODE INT,
@COA VARCHAR(50),
@MAP VARCHAR(10)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @SQL VARCHAR(MAX);

BEGIN
SET @SQL = N'SELECT 
              A.GL_EXCEPT_ID AS ''GL ID''
            , A.COA_SYSTEM AS ''Account Type''
            , A.ENTN AS ''Entity''
            , A.MED_CTR AS ''Medical Center''
            , (''['' + A.LOCN + ''] '' + B.LOCN_DESC) AS ''Location Code''
            , (''['' + A.CTRN + ''] '' + C.CTRN_DESC) AS ''Cost Center''
            , (''['' + RTRIM(A.FUND) + ''] '' + A.FUND_DESC) AS ''Fund''
            , A.ROLLUP_TYPE_ID AS ''Rollup ID''
            , A.ROLLUP_TYPE_DESC AS ''Rollup Type''
            , A.MAPPING AS ''Mapping''
FROM V_ROLLUP_GL_DESC_REV1 A
    LEFT JOIN T_ROLLUP_GL_LOCN B
        ON A.LOCN = B.LOCN
            AND A.MED_CTR_ID = B.MED_CTR_ID
            AND A.COA_SYSTEM = B.COA_SYSTEM
    LEFT JOIN T_ROLLUP_GL_CTRN C
        ON A.CTRN = C.CTRN
            AND A.COA_SYSTEM = C.COA_SYSTEM
WHERE (A.DEPT_ID = '+CONVERT(VARCHAR,@DEPTCODE)+')
        AND A.COA_SYSTEM IN ('+@COA+')
        AND A.MAPPING IN ('+@MAP+''')'
PRINT(@SQL)
EXEC(@SQL)
END
END

Query

USE [Rollup2]
GO

DECLARE @return_value int

EXEC    @return_value = [dbo].[USP_GET_GL_BY_DEPT]
    @DEPTCODE = 1000,
    @COA = N'''COA'',''COA_SYSTEM''',
    @MAP = N'''DEFAULT'',''EXCEPTION'''

SELECT  'Return Value' = @return_value
  • 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-06-09T16:37:40+00:00Added an answer on June 9, 2026 at 4:37 pm

    Part of your problem is:

    @MAP VARCHAR(10)
    

    but you are passing in a value much longer:

    @MAP = N'''DEFAULT'',''EXCEPTION'''
    

    increase your length to:

    @MAP VARCHAR(50)
    

    Second problem is this line, there are too many single quotes:

    AND A.MAPPING IN ('+@MAP+''')'
    

    change it to:

    AND A.MAPPING IN ('+@MAP+')'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pull data from the YouTube API into a local MySQL table.
I am trying to pull in information from Asana API via JQuery.ajax() method. But
Trying to pull the text from a label on the page but it's not
I am trying to pull data from DBF files into my program using C#.
Just trying to pull off some SMART info from connected Hard Drives on any
I am trying to pull a specific set of records from a table called
I am trying to pull an LDAP jpegPhoto attribute from an openLDAP server using
I'm trying to pull a project from git, in particular, this one: https://github.com/pocmo/Yaaic .
Trying to pull a value from the sunrise element from [yweather:astronomy] in the Yahoo
I am trying to pull text from various parts of a webpage and push

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.