Re: How to use the MID function using the Query Builder in VB.NET

Tech-Archive recommends: Fix windows errors by optimizing your registry



If the records always will contain one letter at the beginning you can use
this query (tested on sql server 2000):

select max(cast(substring(YourField,2,len(YourField)-1) as integer))
FROM YourTable

hth Peter


"Eduardo78" <Eduardo78@xxxxxxxxxxxxxxxxxxxxxxxxx> schreef in bericht
news:3714E252-E722-4AAE-83CD-DE6B42D644D4@xxxxxxxxxxxxxxxx
> Ok, I have a Field that has a combination of letter C and a Number that
> increments by one.
>
> example:
> C1
> C2
> C3
> C4
> C5
> C6
> C7
> C9
> C9
> C10
> C11 ...
>
> I would like to find the Maximun number using the query builder. I tried
> using the Substring function but it didnt work, I also tried the LEFT and
> RIGHT functions but didnt work for me.
>
> I tried using the MID function but it gave an error saying 'MID' is not a
> recognized function name.
>
>
> Please I just would like to find any way to get the highest numer after
the
> letter.
>
> Example: if I have C1 thru C34 I wold like the query to give me 34 as the
> result.
>
> Thanks for any suggestions.


.



Relevant Pages

  • Re: Avg() not including 0s
    ... End I get an error saying "ORDER BY items must appear in the select ... optimizer will optimize the query as a unit, ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: How to change the hostname in linux
    ... guddu wrote: ... I had tried all that..and it didnt work. ... So I had to put a query here. ... I had even rebooted the machine after modifying /etc/hosts/. ...
    (comp.os.linux.development.apps)
  • Re: Wildcard use in QBF Combo Box
    ... I had tried that already but for some reason it didnt work. ... the criteria + * as two separate choices in the combo box. ... > Try adding Like to the criteria in the query, ... >> allow them to search for the value from the box with a wildcard. ...
    (microsoft.public.access.queries)
  • Re: Combo Box Issue
    ... You say the combo box is "empty". ... Row Source in any way (a list of items or a query)? ... Wayne Morgan ... > same code but it didnt work. ...
    (microsoft.public.access.forms)
  • Re: insert failed!
    ... > first after hours of trying i switched off pc and read magazine (closer). ... > then came back to problem and changed the insert query from: ... > but i dont know why... ... NO IT DIDNT WORK. ...
    (alt.php)