Re: Custom sort records in a stored proc
From: avnrao (avn_at_newsgroups.com)
Date: 02/24/05
- Next message: Uri Dimant: "Re: multiple paramaters or case"
- Previous message: avnrao: "Re: Problem access db from VB.NET after restoration"
- In reply to: hals_left: "Custom sort records in a stored proc"
- Next in thread: Roji. P. Thomas: "Re: Custom sort records in a stored proc"
- Reply: Roji. P. Thomas: "Re: Custom sort records in a stored proc"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 24 Feb 2005 18:17:13 +0530
There are different ways you can implement this.
1. like switch statement : based on parameter, you execute the respective
select statement.
2. pass tablename, columnnames as parameters - and execute them using
dynamic sql.
3. create another table that holds information like tablename, columns to be
returned and a key. when the key is passed in dynamicaly prepare the select
statemetn to returns columns of tht table.
there could be other ways too..but you have to consider the flexibility,
maintainability and in somecases performance also..
hth,
-- Av. http://dotnetjunkies.com/WebLog/avnrao http://www28.brinkster.com/avdotnet "hals_left" <cc900630@ntu.ac.uk> wrote in message news:c04136bd.0502240438.305a294@posting.google.com... > I have several stored procs that return two columns of data - primary > key values and another column, eg. Categories, Regions. Used to > populate select lists in HTML. > > Is there a way to pass a parameter to the proc that represents a > specific primary key value and have the corresponsding record appear > first in the result set? and also have it igonre the parameter if its > -1. > > Thanks > hals_left
- Next message: Uri Dimant: "Re: multiple paramaters or case"
- Previous message: avnrao: "Re: Problem access db from VB.NET after restoration"
- In reply to: hals_left: "Custom sort records in a stored proc"
- Next in thread: Roji. P. Thomas: "Re: Custom sort records in a stored proc"
- Reply: Roji. P. Thomas: "Re: Custom sort records in a stored proc"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|