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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:24:04+00:00 2026-05-27T00:24:04+00:00

Basically, i wanted to return only one row and one column of result from

  • 0

Basically, i wanted to return only one row and one column of result from a stored procedure..

For example, my sample data and table is like this below:

ColoumA INT
ColoumB INT
ColoumC NVARCHAR(MAX)

ColoumA  ColoumB  ColoumC
   1       1      ErrorMessage1
   2       2      ErrorMessage2
   3       3      ErrorMessage3

After i Execute Successfully the stored procedure successfully,If Successful,
the return result is a string value that combine all the detail above.Such as

Or in another Word, i wanted to stored all the value in TBL.rows[0][0]

in C#.net when i get call the Code

String ReturnValue = "";
Datatable tbl = new Datatable(AREA);
ReturnValue = tbl.Rows[0][0].ToString().Trim();
Console.Writeline("Sample Output");
Console.Writeline(ReturnValue);

I Expected something like this:

Sample Output
ColoumA: 1, ColoumB 1, ErrorMessage1
ColoumB: 2, ColoumB 2, ErrorMessage2
ColoumC: 3, ColoumC 3, ErrorMessage3

Am I Able to do the selection using T-Sql Statment? And if can do So? how can i get it?

Hopefully Someone can understand and answer my question.

Thank You:

PS:Sorry For my poor English Explanation

  • 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-27T00:24:05+00:00Added an answer on May 27, 2026 at 12:24 am

    My strong recommendation here would be: don’t. Access it as a grid (regular SELECT), and do any processing at your app-tier, i.e.

    var sb = new StringBuilder();
    using(var reader = cmd.ExecuteReader()) {
      while(reader.Read()) {
        sb.Append("ColoumA: ").Append(reader.GetInt32(0))
          .Append(", Coloum B").Append(reader.GetInt32(1))
          .Append(", ").Append(reader.GetString(2)).AppendLine();
      }
    }
    string s  = sb.ToString();
    

    However, you can probably do it in TSQL via:

    declare @result varchar(max) = ''
    select @result = @result + 'ColoumA: ' + CONVERT(ColoumA, varchar(10)) +
              ', ColoumB ' + CONVERT(ColoumB, varchar(10)) + ', ' + ColoumC + '
    ' -- newline!
    from ...
    
    select @result
    

    the select @result = @result + ... pattern does pretty much what you describe.

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

Sidebar

Related Questions

I wanted to add a new property to one of my model (table). Basically
I wanted to create a new property on a table in my model.. Basically
I wanted to have a javascript function to basically return an array of all
Basically I wanted to do something like git push mybranch to repo1, repo2, repo3
I have created a 3D structure(basically an image) dynamically using kit3D.However,I wanted to zoom
Basically I am trying to restart a service from a php web page. Here
Basically, I've wanted to get back into Python, so I decided to make a
I wanted to have more than one controller and view for same object/model in
So I am writing a packet sniffing app. Basically I wanted it to sniff
I'm creating a class that can read from a dicom file. This is basically

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.