Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Server Syntax?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00495857
Message ID:
00495930
Vues:
12
>>you can use CONVERT(int, )
>
>I used :
>
>SELECT cast(g1csf.pacid /10000000 as int) as UREG, g1csf.*
>into ProgeddTests
> FROM g1csf INNER JOIN g1_cnsin
> ON G1csf.cnsinv = G1_cnsin.cnsinv
> where substring(ltrim(str(g1csf.pacid,14)),8,2) ='20'
>and substring(ltrim(str(g1csf.pacid,14)),1,2) ='26'
>
>
>any idea why a Having Clause cannot find the UREG column that is in position 1 of the table in a having clause?
>
>The last line of my SQL should read something like:
>Having UREG >= 26000
>
>
>__Stephen

SQL Server doesn't like field aliases in its GROUP BY or HAVING clauses. Copy the actual expression definition into the HAVING clause.
SELECT cast(g1csf.pacid /10000000 as int) as UREG, g1csf.*
into ProgeddTests
 FROM  g1csf INNER JOIN g1_cnsin
   ON  G1csf.cnsinv = G1_cnsin.cnsinv
   where substring(ltrim(str(g1csf.pacid,14)),8,2) ='20'
and substring(ltrim(str(g1csf.pacid,14)),1,2) ='26'
having cast(g1csf.pacid /10000000 as int) >= 26000
HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform