This is a discussion on Equivalent query within the Informix forums, part of the Database Server Software category; --> Hello I have a question is there an equivalent of the "TOP" function of sql server in informix I ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello I have a question is there an equivalent of the "TOP" function of sql server in informix I need something like this but in the informix sintax: DECLARE @var1 integer SET @var1 = (select count(*) from table) DECLARE @var2 integer SET @var2 = 200 select top (@var1 - @var2) * from table I'm using C# to develop my application that has access to informix but |
| |||
| TRY: SELECT FIRST <NUMBER OF ROWS> * FROM <TABLE> On 4 Oct 2006 16:41:32 -0700, luissol <luissol@gmail.com> wrote: > > Hello > > I have a question is there an equivalent of the "TOP" function of sql > server in informix > > I need something like this but in the informix sintax: > > DECLARE @var1 integer > SET @var1 = (select count(*) from table) > DECLARE @var2 integer > SET @var2 = 200 > select top (@var1 - @var2) * from table > > I'm using C# to develop my application that has access to informix but > > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list > |
| |||
| luissol wrote: > Hello > > I have a question is there an equivalent of the "TOP" function of sql > server in informix http://publib.boulder.ibm.com/infoce...53.htm#idx3051 >DECLARE @var1 integer >SET @var1 = (select count(*) from table) >DECLARE @var2 integer >SET @var2 = 200 >select top (@var1 - @var2) * from table You may want to read up on dynamic SQL within Informix too... Rich |
| ||||
| luissol wrote: > I have a question is there an equivalent of the "TOP" function of sql > server in informix > > I need something like this but in the informix sintax: > > DECLARE @var1 integer > SET @var1 = (select count(*) from table) > DECLARE @var2 integer > SET @var2 = 200 > select top (@var1 - @var2) * from table > > I'm using C# to develop my application that has access to informix but Question for you? Are you aware that there is no particular order inherent in the way the data is returned from the database? Or, put another way, do you realize that even if we can agree that "SELECT TOP 30 * FROM SomeTable" can be achieved, then the contents you get is indeterminate. If the table isn't fragmented and hasn't had any records deleted, then you will probably get the data in the order it was inserted - but that is far from guaranteed. If you dive into the theory behind databases, you'll find that tables are sets of rows, and sets do not have any order. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/ |
| Thread Tools | |
| Display Modes | |
|
|