473,320 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 3424
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.