🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.databases
Article #163

Re: (Q): SQL-Queries

#163
From: Ajay Wadhia
Date: Tue, 21 Oct 1997 00:00
125 lines
4079 bytes
for prob. 1 pls read Cast function interBase help
Regards

ajay

Benoit Chailler wrote:

> Heinz A. Krebs Dipl.-Ing. wrote:
>
> > servas!
> >
> > i have three small questions about sql-queries:
> >
> > 1. how can i make a case-insensitive selection? if i make the
> following:
> >      SELECT titel FROM database WHERE titel LIKE '%apple%'
> >    i don't get the entries with 'Apple', but i want them all!
> >
> > 2. can i retrieve a record by his recordnumber like
> >      SELECT titel, rezept FROM database WHERE recordnumber=4162
> >
>
> The record number is not support in SQL.But you can do something
> similar.When a select return you a set, be sure you always sort the
> result
> set by
> the same field and   do that
>
> declare @field varchar(10)   <- the same lenght and datatype of the
> field
> you need
> declare @rownumber
>
> select @rownumber = 4162
>
> declare scur scroll cursor for
>   select field from table order by field
>
> open scur
>
> fetch first from scur into @field
> if @@CURSOR_ROWS >= @rownumber
> begin
>    fetch absolute @rownumber from scur into @field
> end
> else
> begin
>    select @field = null
> end
>
> close scur
> deallocate scur
>
> if @field is not null
> begin
>   select * from table where field = @field   <- it's the 4162nd row
> end
> else
> begin
>    print 'This row does not exist.'
> end
>
> with this example, you use CURSOR statement. It's look like a recno.
>
> > 3. where can i get a good explanation of SQL-statements on the web
> to
> >    avoid further boring questions by me?  ;-)
> >
>
> Search for a book of SQL 92    by   C.J. Date (the one who think SQL)
>
> > ciao
> >   H.
> >
> >
> ***********************************************************************
>
> >                    KOS - Kochbuch Online System
> >
> >   45000 Kochrezepte online  siehe unter http://www.styria.co.at/kos/
>
> >
> ***********************************************************************
>
> > Heinz A. Krebs Dipl.Ing.        voice:  43-1-4077234 or
> 43-1-58801-5011
> > Vienna University               fax:
> 43-1-4077235
> >   of Technology                 email:
> hkrebs@fbch.tuwien.ac.at
> > Institute of Organic Chemistry  WWW: http://info.tuwien.ac.at/
> >   Department Naturstoffsynthese                      orgchem/krebs/
> > Getreidemarkt 9/9/154           fido:
> 2:310/67
> > A - 1060 Wien                   mailbox:
> 43-1-4077235
> >
> ***********************************************************************
>
> --
> Benoit Chailler
> mailto:benoit@ic2c.com
> Images Coast 2 Coast
> http://www.ic2c.com
>
>
> -------------------------------------------------------------------------------------------------------------
>
>   Benoit Chailler <benoit@ic2c.com>
>   DBA
>   Images Coast 2 Coast
>
>   Benoit Chailler
>   DBA                   <benoit@ic2c.com>
>   Images Coast 2 Coast
>   1000 St-Antoine #303  Work: (514) 868-0874
>   Montreal              Fax: (514) 868-0875
>   Quebec                Home: (514) 237-3141
>   H3C 3R7               Netscape Conference Address
>   Canada                Netscape Conference DLS Server
>   Additional Information:
>   Last Name    Chailler
>   First Name   Benoit
>   Version      2.1
Technical Details
Message-ID: <344C18DF.B6050D6B@hotmail.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <344B1EAD.E25@fbch.tuwien.ac.at> <344B6B9D.7851F65@ic2c.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ffff5,c6b02df51994e2b0
X-Google-Attributes: gidffff5,public
X-Google-Thread: 10de66,c6b02df51994e2b0
X-Google-Attributes: gid10de66,public
X-Google-Thread: 11301e,c6b02df51994e2b0
X-Google-Attributes: gid11301e,public
From: Ajay Wadhia <buntyw@hotmail.com>
Subject: Re: (Q): SQL-Queries
Date: 1997/10/21
Message-ID: <344C18DF.B6050D6B@hotmail.com>
X-Deja-AN: 282118636
References: <344B1EAD.E25@fbch.tuwien.ac.at> <344B6B9D.7851F65@ic2c.com>
To: Benoit Chailler <benoit@ic2c.com>
X-Priority: 3 (Normal)
Organization: None
Reply-To: buntyw@hotmail.com
Newsgroups: comp.lang.pascal.delphi.databases,borland.public.delphi.database.sqlservers,microsoft.public.sqlserver.programming