473,396 Members | 2,052 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,396 software developers and data experts.

output parameters from row with max id

I am trying to select multiple values from the row with the max id,
and output them within my stored procedure. How would I combine the
following two rows so that I only need to use "from mytable where
IDnum = (select (max(IDnum)) from mytable))" once. I have at least 8
other outputs I will be setting and would like this to work more
efficiently than setting each individually... if possible.

set @outmtd = (select outmtd from mytable where IDnum = (select
(max(IDnum)) from mytable))
set @outytd = (select outytd from mytable where IDnum = (select
(max(IDnum)) from mytable))

Thanks for any help you can give

Matt

Jul 31 '07 #1
3 2106
>I am trying to select multiple values from the row with the max id, and output them within my stored procedure. <<

Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, data types, etc. in
your schema are. If you know how, follow ISO-11179 data element naming
conventions. Sample data is also a good idea, along with clear
specifications. It is very hard to debug code when you do not let us
see it.

Jul 31 '07 #2
On Aug 1, 2:45 am, mcolson <mcolson1...@gmail.comwrote:
I am trying to select multiple values from the row with the max id,
and output them within my stored procedure. How would I combine the
following two rows so that I only need to use "from mytable where
IDnum = (select (max(IDnum)) from mytable))" once. I have at least 8
other outputs I will be setting and would like this to work more
efficiently than setting each individually... if possible.

set @outmtd = (select outmtd from mytable where IDnum = (select
(max(IDnum)) from mytable))
set @outytd = (select outytd from mytable where IDnum = (select
(max(IDnum)) from mytable))

Thanks for any help you can give

Matt
I think this is what looking

select @outytd=outytd,@outmtd=outmtd
from mytable where IDnum = (select
(max(IDnum)) from mytable)

Aug 1 '07 #3
On Jul 31, 10:29 pm, shiju <shiju.sam...@gmail.comwrote:
On Aug 1, 2:45 am, mcolson <mcolson1...@gmail.comwrote:I am trying to select multiple values from the row with the max id,
and output them within my stored procedure. How would I combine the
following two rows so that I only need to use "from mytable where
IDnum = (select (max(IDnum)) from mytable))" once. I have at least 8
other outputs I will be setting and would like this to work more
efficiently than setting each individually... if possible.
set @outmtd = (select outmtd from mytable where IDnum = (select
(max(IDnum)) from mytable))
set @outytd = (select outytd from mytable where IDnum = (select
(max(IDnum)) from mytable))
Thanks for any help you can give
Matt

I think this is what looking

select @outytd=outytd,@outmtd=outmtd
from mytable where IDnum = (select
(max(IDnum)) from mytable)
that was exactly what I needed. Thanks

Aug 1 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bari Allen | last post by:
I have a Stored procedure in SQL, that works, when tested in SQL, with one input & several output parameters, as follows: CREATE PROCEDURE myProcedure @MyID int , @First varchar(80) OUTPUT ,...
5
by: vivienne.netherwood | last post by:
I am developing an Access Project front end with a SQL server database. I have written a stored procedure that returns a record set and also a value via an output parameter. The procedure is as...
4
by: Janaka | last post by:
Hi this is kind of an ASP.NET/ADO.NET question. I've got a stored procedure on SQL Server that returns a results set. It also sets 3 output parameters in a seperate Select statement. When...
2
by: Bari Allen | last post by:
ASP Classic question: I have a Stored procedure in SQL, that works, when tested in SQL, with one input & several output parameters, as follows: CREATE PROCEDURE myProcedure @MyID int , @First...
3
by: juststarter | last post by:
Hello all, I am executing a stored procedure (on an SQL Server) using ODBC but i can't get the output parameter's value on the client. The stored proc has 3 parameters ,2 of them are input and 1...
1
by: Joe Van Meer | last post by:
Hi all, I have an app that currently runs through 3 seperate stored procedures each returning a count of records. What I would like to do is combine these calls into one call, however I am...
1
by: Garth Wells | last post by:
Using an example in the Jan 2006 release of the Enterprise Library, I came up with the code shown below to create a DAL method for returning several columns of a single row. I place the output...
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...
1
by: John Bailo | last post by:
This is a my solution to getting an Output parameter from a SqlDataSource. I have seen a few scant articles but none of them take it all the way to a solution. Hopefully this will help some...
2
by: gabosom | last post by:
Hi! I've been breaking my head trying to get the output variables from my Stored Procedure. This is my SP code CREATE PROCEDURE GetKitchenOrderDetail( @idService int, --outPut Variables ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.