472,791 Members | 1,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 software developers and data experts.

Return more than one value(store procedure)

can i do like this Return (4),@fieldname
an how to asign value @fieldname with the value of fieldname that use select from table?
Nov 7 '08 #1
2 3408
Delerna
1,134 Expert 1GB
I don't follow what you mean by

Return (4),@fieldname
Please explain more fully?

as to assigning @fieldname to the result of a select

Expand|Select|Wrap|Line Numbers
  1.  
  2. set @fieldname=(select TheField from TheTable)
  3.  
  4.  
Of course, the select statement must return 1 record only in the above example.
Nov 12 '08 #2
Delerna
1,134 Expert 1GB
If you mean you want to return the value of a field that is identified by @fieldname, then you will need to use dynamic query for that.

something like

Expand|Select|Wrap|Line Numbers
  1.  
  2. DECLARE @SQLString NVARCHAR(500) --Must be NVARCHAR
  3.  
  4. set @SQLString='SELECT ' + @fieldname + '  FROM YourTable'
  5.  
  6. EXEC sp_executesql @SQLString
  7.  
  8.  
Nov 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Cognizance | last post by:
I need a solution for the following, if anyone can think of one. :) I have: 1 form on the page. (no name, no id value set.) 3 hidden form elements named: catalog, vwoidc, oid !!! I can only...
1
by: tfs | last post by:
I have a variable I am trying to keep the values in and I have it set as a global variable. <script runat="server"> Dim saveCommandText as String Sub SortDataGrid (sender as Object, e as...
7
by: kandi111777 | last post by:
I have a form that includes a drop down box. I can get all of the other values to show up in an e-mail except for the drop down box values. Can someone please help? -- I know the HTML isn't the...
2
by: philip | last post by:
hello, i am new to asp.net and sql server, and i have 3 questions for asking: 1. i am writing a store procedure of login validation for my asp.net application and wondering what the different...
6
by: c676228 | last post by:
Hi everyone, I wrote a store procedure that fetch one row data in the database based on the parameter value I entered. After I created the store procedure, the store procedure code looks like...
4
by: raghav | last post by:
Hi all I am having a SP which is returning a value......Now I have to store that value in session...I saw some examples in msdn lib ----> string Name=string.Empty; Session=Name.ToString(); ...
0
by: c81 | last post by:
Helo, can i make to read in my dotnet application to read @@RETURN Var of my store procedure ? thx,
2
by: semi_evil | last post by:
Hi, I have recently taken up PHP programming, and I got stuck on the following. <? $p_body = (isset ($_POST) && ($_POST != '')) ? $_POST : 'Enter your text here'; $p_name = (isset ($_POST) &&...
0
by: seep | last post by:
salam to everyone.. as a new bee in .net i m finding lot of difficulty. i want to get all records of a table from database via store procedure.but spending many days i dont know how can i do...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.