Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Support for ordering on AS
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01391988
Message ID:
01459276
Vues:
42
This is incorrect. SQL Server does support ORDER BY on a column alias. It also does support ordering by function.

>No, SQL Server does not support ORDER BY or GROUP BY on a column alias. You can use a derived table to get around such limitations. In most cases the execution plan will be the same.
>
>SELECT* FROM (
>  SELECT [New].[Numero] AS FTNumero,New.AddDate,New.Titre AS Title,New.Numero,New.ModDate,New.Url
>    FROM [New]
>     WHERE New.Type=@Type AND New.Status=@Status AND New.NoMember=@NoMember
>  ) dt1
>    ORDER BY UPPER(Title)
>
>
>BTW, why do you use UPPER() in the ORDER BY? Is this column case sensitive?
>
>>I thought SQL Server was supporting the ordering on an AS field. Can someone confirm me that this is not supported:
>>
>>
>>DECLARE @Type Integer
>>DECLARE @Status Integer
>>DECLARE @NoMember Integer
>>
>>SET @Type=4
>>SET @Status=2
>>SET @NoMember=49716
>>
>>SELECT [New].[Numero] AS FTNumero,New.AddDate,New.Titre AS Title,New.Numero,New.ModDate,New.Url
>>  FROM [New]
>>   WHERE New.Type=@Type AND New.Status=@Status AND New.NoMember=@NoMember
>>   ORDER BY UPPER(Title)
>>
>>
>>Basically, to have this working, I have to do this:
>>
>>
>>DECLARE @Type Integer
>>DECLARE @Status Integer
>>DECLARE @NoMember Integer
>>
>>SET @Type=4
>>SET @Status=2
>>SET @NoMember=49716
>>
>>SELECT [New].[Numero] AS FTNumero,New.AddDate,New.Titre AS Title,New.Numero,New.ModDate,New.Url
>>  FROM [New]
>>   WHERE New.Type=@Type AND New.Status=@Status AND New.NoMember=@NoMember
>>   ORDER BY UPPER(New.Titre)
>>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform