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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:32:10+00:00 2026-05-18T05:32:10+00:00

How to get rows as comma separated values. select [name] from sys.objects where type=’u’

  • 0

How to get rows as comma separated values.

select [name] from sys.objects where type='u'

i get this :

DropDownList
SubActivityDetails
Report
Employees
UserMaster
ProjectMaster

i want this :

DropDownList,SubActivityDetails,Report,Employees,UserMaster,ProjectMaster

in a single Query only

And also in this case

select [name],[object_id] from sys.objects where type='u'

I get this:

DropDownList    66099276
SubActivityDetails  197575742
Report  254623950
Employees   270624007

But I want this:

  ["SubActivityDetails",197575742],
  ["Report",254623950],
  ["Employees",270624007]

so that its similar to json.

And there would be lot of data, so performance is a major concern!

which is better

case 1 :

DECLARE @Val VARCHAR(MAX)
begin
select @Val = isnull(@val + ‘,’ + [name],[name])
from sys.objects
where type=’u’
SELECT @Val
end

case 2 :

DECLARE @Val VARCHAR(MAX)
begin
select @Val = COALESCE(@val + ‘,’ + [name],[name])
from sys.objects
where type=’u’
SELECT @Val
end

  • 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-18T05:32:11+00:00Added an answer on May 18, 2026 at 5:32 am

    Have a look at something like this

    DECLARE @Val VARCHAR(MAX)
    select  @Val = COALESCE(@val + ',' + [name], [name])
    from    sys.objects 
    where   type='u' 
    
    SELECT @Val
    

    Ok, so for the second query we can try

    DECLARE @Val VARCHAR(MAX)
    
    select  @Val = COALESCE(@val + ',' + '["' + [name] + '",' + CAST([object_id] AS VARCHAR(50)) + ']', '["' + [name] + '",' + CAST([object_id] AS VARCHAR(50)) + ']') 
    from    sys.objects 
    where   type='u' 
    
    SELECT @Val
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my goal is to get lots of rows from a translation table. I use
Is there a way to get the count of rows in all tables in
Does anybody know how I can get the number of the elements (rows*cols) returned
What's the best way to get the rank of the rows in addition to
We get a large amount of data from our clients in pdf files in
I get an Access is Denied error message when I use the strong name
I get a URL from a user. I need to know: a) is the
We get the following error; The request was aborted: Could not create SSL/TLS secure
I get the following error when running my Visual Studio 2008 ASP.NET project (start
I get the following error when building my Windows Forms solution: LC.exe exited with

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.