select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)...
David
"Michel" a écrit dans le message de news:
Bonjour a tous,
J'effectue une requete avec un calcul
select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd as solde
je voudrais avoir la valeur du calcul si le résultat est positif et 0 si
il
est négatif !
comment faire???
Merci pour votre aide
Michel
Michel
Merci David,
Je venais de trouver la solution en fait avec entrepise manager en SQL designer la commande CASE n'est pas acceptée...
"David.V" a écrit :
avec CASE :
select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)...
David
"Michel" a écrit dans le message de news: > Bonjour a tous, > > J'effectue une requete avec un calcul > > select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd as > solde > > je voudrais avoir la valeur du calcul si le résultat est positif et 0 si il > est négatif ! > > comment faire??? > > Merci pour votre aide > > Michel
Merci David,
Je venais de trouver la solution
en fait avec entrepise manager en SQL designer la commande CASE n'est pas
acceptée...
"David.V" a écrit :
avec CASE :
select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd -
detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)...
David
"Michel" <Michel@discussions.microsoft.com> a écrit dans le message de
news:F0852095-423F-4CA8-BE2C-11C511665221@microsoft.com...
> Bonjour a tous,
>
> J'effectue une requete avec un calcul
>
> select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd as
> solde
>
> je voudrais avoir la valeur du calcul si le résultat est positif et 0 si
il
> est négatif !
>
> comment faire???
>
> Merci pour votre aide
>
> Michel
Je venais de trouver la solution en fait avec entrepise manager en SQL designer la commande CASE n'est pas acceptée...
"David.V" a écrit :
avec CASE :
select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)...
David
"Michel" a écrit dans le message de news: > Bonjour a tous, > > J'effectue une requete avec un calcul > > select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd as > solde > > je voudrais avoir la valeur du calcul si le résultat est positif et 0 si il > est négatif ! > > comment faire??? > > Merci pour votre aide > > Michel
Philippe T [MS]
Bonjour,
Pour faire ses requêtes, rien ne vaut un bon query analyzer !!! :-)
Phil. ________________________________________________________ Philippe TROTIN http://blogs.msdn.com/ptrotin Microsoft Services France http://www.microsoft.com/france
"Michel" wrote in message news:
Merci David,
Je venais de trouver la solution en fait avec entrepise manager en SQL designer la commande CASE n'est pas acceptée...
"David.V" a écrit :
> avec CASE : > > select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd - > detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)... > > David > > "Michel" a écrit dans le message de > news: > > Bonjour a tous, > > > > J'effectue une requete avec un calcul > > > > select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd
as
> > solde > > > > je voudrais avoir la valeur du calcul si le résultat est positif et 0
si
> il > > est négatif ! > > > > comment faire??? > > > > Merci pour votre aide > > > > Michel > > >
Bonjour,
Pour faire ses requêtes, rien ne vaut un bon query analyzer !!! :-)
Phil.
________________________________________________________
Philippe TROTIN http://blogs.msdn.com/ptrotin
Microsoft Services France http://www.microsoft.com/france
"Michel" <Michel@discussions.microsoft.com> wrote in message
news:DF411EAD-C190-449F-83A8-EE8598853496@microsoft.com...
Merci David,
Je venais de trouver la solution
en fait avec entrepise manager en SQL designer la commande CASE n'est pas
acceptée...
"David.V" a écrit :
> avec CASE :
>
> select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd -
> detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)...
>
> David
>
> "Michel" <Michel@discussions.microsoft.com> a écrit dans le message de
> news:F0852095-423F-4CA8-BE2C-11C511665221@microsoft.com...
> > Bonjour a tous,
> >
> > J'effectue une requete avec un calcul
> >
> > select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd
as
> > solde
> >
> > je voudrais avoir la valeur du calcul si le résultat est positif et 0
si
> il
> > est négatif !
> >
> > comment faire???
> >
> > Merci pour votre aide
> >
> > Michel
>
>
>
Pour faire ses requêtes, rien ne vaut un bon query analyzer !!! :-)
Phil. ________________________________________________________ Philippe TROTIN http://blogs.msdn.com/ptrotin Microsoft Services France http://www.microsoft.com/france
"Michel" wrote in message news:
Merci David,
Je venais de trouver la solution en fait avec entrepise manager en SQL designer la commande CASE n'est pas acceptée...
"David.V" a écrit :
> avec CASE : > > select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd - > detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)... > > David > > "Michel" a écrit dans le message de > news: > > Bonjour a tous, > > > > J'effectue une requete avec un calcul > > > > select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd
as
> > solde > > > > je voudrais avoir la valeur du calcul si le résultat est positif et 0
si
> il > > est négatif ! > > > > comment faire??? > > > > Merci pour votre aide > > > > Michel > > >
Fred BROUARD
Et philippe je vais me marrer car je me demande comment cette interface va permettre de réaliser graphiquement des requêtes récursives acceptée maintenant dans la v 2005, du genre :
WITH T_CONTRAINTES (nom_table, nom_table_pere) AS (SELECT DISTINCT CTU.TABLE_NAME, TCT.TABLE_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RFC INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE CTU ON RFC.CONSTRAINT_CATALOG = CTU.CONSTRAINT_CATALOG AND RFC.CONSTRAINT_SCHEMA = CTU.CONSTRAINT_SCHEMA AND RFC.CONSTRAINT_NAME = CTU.CONSTRAINT_NAME INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS TCT ON RFC.UNIQUE_CONSTRAINT_CATALOG = TCT.CONSTRAINT_CATALOG AND RFC.UNIQUE_CONSTRAINT_SCHEMA = TCT.CONSTRAINT_SCHEMA AND RFC.UNIQUE_CONSTRAINT_NAME = TCT.CONSTRAINT_NAME WHERE CTU.TABLE_CATALOG = @DB_NAME RECURSIVE T_TREE_CONTRAINTES (table_a_supprimer, niveau) AS (SELECT DISTINCT nom_table, 0 FROM T_CONTRAINTES WHERE nom_table_pere = @TABLE_NAME UNION ALL SELECT precedent.nom_table, niveau - 1 FROM T_CONTRAINTES precedent INNER JOIN T_TREE_CONTRAINTES debut ON debut.table_a_supprimer = precedent.nom_table_pere WHERE precedent.nom_table_pere <> precedent.nom_table) SELECT DISTINCT * FROM T_TREE_CONTRAINTES ORDER BY niveau
qui permet de lister les tables à supprimer préalablement à une table donnée (@TABLE_NAME) dans la base donnée (@DB_NAME) et dans l'ordre !
A +
-- Frédéric BROUARD, MVP SQL Server. Expert SQL / spécialiste Delphi, web Livre SQL - col. Référence : http://sqlpro.developpez.com/bookSQL.html Le site du SQL, pour débutants et pros : http://sqlpro.developpez.com ************************ www.datasapiens.com *************************
Philippe T [MS] a écrit:
Bonjour,
Pour faire ses requêtes, rien ne vaut un bon query analyzer !!! :-)
Phil. ________________________________________________________ Philippe TROTIN http://blogs.msdn.com/ptrotin Microsoft Services France http://www.microsoft.com/france
"Michel" wrote in message news:
Merci David,
Je venais de trouver la solution en fait avec entrepise manager en SQL designer la commande CASE n'est pas acceptée...
"David.V" a écrit :
avec CASE :
select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)...
je voudrais avoir la valeur du calcul si le résultat est positif et 0
si
il
est négatif !
comment faire???
Merci pour votre aide
Michel
Et philippe je vais me marrer car je me demande comment cette interface va
permettre de réaliser graphiquement des requêtes récursives acceptée maintenant
dans la v 2005, du genre :
WITH
T_CONTRAINTES (nom_table, nom_table_pere)
AS (SELECT DISTINCT CTU.TABLE_NAME,
TCT.TABLE_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RFC
INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE CTU
ON RFC.CONSTRAINT_CATALOG = CTU.CONSTRAINT_CATALOG
AND RFC.CONSTRAINT_SCHEMA = CTU.CONSTRAINT_SCHEMA
AND RFC.CONSTRAINT_NAME = CTU.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS TCT
ON RFC.UNIQUE_CONSTRAINT_CATALOG = TCT.CONSTRAINT_CATALOG
AND RFC.UNIQUE_CONSTRAINT_SCHEMA = TCT.CONSTRAINT_SCHEMA
AND RFC.UNIQUE_CONSTRAINT_NAME = TCT.CONSTRAINT_NAME
WHERE CTU.TABLE_CATALOG = @DB_NAME
RECURSIVE T_TREE_CONTRAINTES (table_a_supprimer, niveau)
AS (SELECT DISTINCT nom_table, 0
FROM T_CONTRAINTES
WHERE nom_table_pere = @TABLE_NAME
UNION ALL
SELECT precedent.nom_table, niveau - 1
FROM T_CONTRAINTES precedent
INNER JOIN T_TREE_CONTRAINTES debut
ON debut.table_a_supprimer = precedent.nom_table_pere
WHERE precedent.nom_table_pere <> precedent.nom_table)
SELECT DISTINCT *
FROM T_TREE_CONTRAINTES
ORDER BY niveau
qui permet de lister les tables à supprimer préalablement à une table donnée
(@TABLE_NAME) dans la base donnée (@DB_NAME) et dans l'ordre !
A +
--
Frédéric BROUARD, MVP SQL Server. Expert SQL / spécialiste Delphi, web
Livre SQL - col. Référence : http://sqlpro.developpez.com/bookSQL.html
Le site du SQL, pour débutants et pros : http://sqlpro.developpez.com
************************ www.datasapiens.com *************************
Philippe T [MS] a écrit:
Bonjour,
Pour faire ses requêtes, rien ne vaut un bon query analyzer !!! :-)
Phil.
________________________________________________________
Philippe TROTIN http://blogs.msdn.com/ptrotin
Microsoft Services France http://www.microsoft.com/france
"Michel" <Michel@discussions.microsoft.com> wrote in message
news:DF411EAD-C190-449F-83A8-EE8598853496@microsoft.com...
Merci David,
Je venais de trouver la solution
en fait avec entrepise manager en SQL designer la commande CASE n'est pas
acceptée...
"David.V" a écrit :
avec CASE :
select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd -
detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)...
David
"Michel" <Michel@discussions.microsoft.com> a écrit dans le message de
news:F0852095-423F-4CA8-BE2C-11C511665221@microsoft.com...
Et philippe je vais me marrer car je me demande comment cette interface va permettre de réaliser graphiquement des requêtes récursives acceptée maintenant dans la v 2005, du genre :
WITH T_CONTRAINTES (nom_table, nom_table_pere) AS (SELECT DISTINCT CTU.TABLE_NAME, TCT.TABLE_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RFC INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE CTU ON RFC.CONSTRAINT_CATALOG = CTU.CONSTRAINT_CATALOG AND RFC.CONSTRAINT_SCHEMA = CTU.CONSTRAINT_SCHEMA AND RFC.CONSTRAINT_NAME = CTU.CONSTRAINT_NAME INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS TCT ON RFC.UNIQUE_CONSTRAINT_CATALOG = TCT.CONSTRAINT_CATALOG AND RFC.UNIQUE_CONSTRAINT_SCHEMA = TCT.CONSTRAINT_SCHEMA AND RFC.UNIQUE_CONSTRAINT_NAME = TCT.CONSTRAINT_NAME WHERE CTU.TABLE_CATALOG = @DB_NAME RECURSIVE T_TREE_CONTRAINTES (table_a_supprimer, niveau) AS (SELECT DISTINCT nom_table, 0 FROM T_CONTRAINTES WHERE nom_table_pere = @TABLE_NAME UNION ALL SELECT precedent.nom_table, niveau - 1 FROM T_CONTRAINTES precedent INNER JOIN T_TREE_CONTRAINTES debut ON debut.table_a_supprimer = precedent.nom_table_pere WHERE precedent.nom_table_pere <> precedent.nom_table) SELECT DISTINCT * FROM T_TREE_CONTRAINTES ORDER BY niveau
qui permet de lister les tables à supprimer préalablement à une table donnée (@TABLE_NAME) dans la base donnée (@DB_NAME) et dans l'ordre !
A +
-- Frédéric BROUARD, MVP SQL Server. Expert SQL / spécialiste Delphi, web Livre SQL - col. Référence : http://sqlpro.developpez.com/bookSQL.html Le site du SQL, pour débutants et pros : http://sqlpro.developpez.com ************************ www.datasapiens.com *************************
Philippe T [MS] a écrit:
Bonjour,
Pour faire ses requêtes, rien ne vaut un bon query analyzer !!! :-)
Phil. ________________________________________________________ Philippe TROTIN http://blogs.msdn.com/ptrotin Microsoft Services France http://www.microsoft.com/france
"Michel" wrote in message news:
Merci David,
Je venais de trouver la solution en fait avec entrepise manager en SQL designer la commande CASE n'est pas acceptée...
"David.V" a écrit :
avec CASE :
select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif' END)...
je voudrais avoir la valeur du calcul si le résultat est positif et 0
si
il
est négatif !
comment faire???
Merci pour votre aide
Michel
Philippe T [MS]
Bonjour,
Je ne suis pas un fervent utilisateur des builders de requètes mais ces builders ne sont qu'une aide aux requêtes simples et ne remplace pas à mon avis une bonne connaissance du langage SQL.
Phil. ________________________________________________________ Philippe TROTIN http://blogs.msdn.com/ptrotin Microsoft Services France http://www.microsoft.com/france
"Fred BROUARD" wrote in message news:
Et philippe je vais me marrer car je me demande comment cette interface va permettre de réaliser graphiquement des requêtes récursives acceptée
maintenant
dans la v 2005, du genre :
WITH T_CONTRAINTES (nom_table, nom_table_pere) AS (SELECT DISTINCT CTU.TABLE_NAME, TCT.TABLE_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RFC INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE CTU ON RFC.CONSTRAINT_CATALOG = CTU.CONSTRAINT_CATALOG AND RFC.CONSTRAINT_SCHEMA = CTU.CONSTRAINT_SCHEMA AND RFC.CONSTRAINT_NAME = CTU.CONSTRAINT_NAME INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS TCT ON RFC.UNIQUE_CONSTRAINT_CATALOG = TCT.CONSTRAINT_CATALOG AND RFC.UNIQUE_CONSTRAINT_SCHEMA = TCT.CONSTRAINT_SCHEMA AND RFC.UNIQUE_CONSTRAINT_NAME = TCT.CONSTRAINT_NAME WHERE CTU.TABLE_CATALOG = @DB_NAME RECURSIVE T_TREE_CONTRAINTES (table_a_supprimer, niveau) AS (SELECT DISTINCT nom_table, 0 FROM T_CONTRAINTES WHERE nom_table_pere = @TABLE_NAME UNION ALL SELECT precedent.nom_table, niveau - 1 FROM T_CONTRAINTES precedent INNER JOIN T_TREE_CONTRAINTES debut ON debut.table_a_supprimer = precedent.nom_table_pere WHERE precedent.nom_table_pere <> precedent.nom_table) SELECT DISTINCT * FROM T_TREE_CONTRAINTES ORDER BY niveau
qui permet de lister les tables à supprimer préalablement à une table
donnée
(@TABLE_NAME) dans la base donnée (@DB_NAME) et dans l'ordre !
A +
-- Frédéric BROUARD, MVP SQL Server. Expert SQL / spécialiste Delphi, web Livre SQL - col. Référence : http://sqlpro.developpez.com/bookSQL.html Le site du SQL, pour débutants et pros : http://sqlpro.developpez.com ************************ www.datasapiens.com *************************
Philippe T [MS] a écrit: > Bonjour, > > Pour faire ses requêtes, rien ne vaut un bon query analyzer !!! :-) > > Phil. > ________________________________________________________ > Philippe TROTIN http://blogs.msdn.com/ptrotin > Microsoft Services France http://www.microsoft.com/france > > "Michel" wrote in message > news: > >>Merci David, >> >>Je venais de trouver la solution >>en fait avec entrepise manager en SQL designer la commande CASE n'est
pas
>>acceptée... >> >> >> >>"David.V" a écrit : >> >> >>>avec CASE : >>> >>>select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd - >>>detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif'
END)...
>>> >>>David >>> >>>"Michel" a écrit dans le message de >>>news: >>> >>>>Bonjour a tous, >>>> >>>>J'effectue une requete avec un calcul >>>> >>>>select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd > > as > >>>>solde >>>> >>>>je voudrais avoir la valeur du calcul si le résultat est positif et 0 > > si > >>>il >>> >>>>est négatif ! >>>> >>>>comment faire??? >>>> >>>>Merci pour votre aide >>>> >>>>Michel >>> >>> >>> > >
Bonjour,
Je ne suis pas un fervent utilisateur des builders de requètes mais ces
builders ne sont qu'une aide aux requêtes simples et ne remplace pas à mon
avis une bonne connaissance du langage SQL.
Phil.
________________________________________________________
Philippe TROTIN http://blogs.msdn.com/ptrotin
Microsoft Services France http://www.microsoft.com/france
"Fred BROUARD" <brouardf@club-internet.fr> wrote in message
news:4233F871.9030303@club-internet.fr...
Et philippe je vais me marrer car je me demande comment cette interface va
permettre de réaliser graphiquement des requêtes récursives acceptée
maintenant
dans la v 2005, du genre :
WITH
T_CONTRAINTES (nom_table, nom_table_pere)
AS (SELECT DISTINCT CTU.TABLE_NAME,
TCT.TABLE_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RFC
INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE CTU
ON RFC.CONSTRAINT_CATALOG = CTU.CONSTRAINT_CATALOG
AND RFC.CONSTRAINT_SCHEMA = CTU.CONSTRAINT_SCHEMA
AND RFC.CONSTRAINT_NAME = CTU.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS TCT
ON RFC.UNIQUE_CONSTRAINT_CATALOG = TCT.CONSTRAINT_CATALOG
AND RFC.UNIQUE_CONSTRAINT_SCHEMA = TCT.CONSTRAINT_SCHEMA
AND RFC.UNIQUE_CONSTRAINT_NAME = TCT.CONSTRAINT_NAME
WHERE CTU.TABLE_CATALOG = @DB_NAME
RECURSIVE T_TREE_CONTRAINTES (table_a_supprimer, niveau)
AS (SELECT DISTINCT nom_table, 0
FROM T_CONTRAINTES
WHERE nom_table_pere = @TABLE_NAME
UNION ALL
SELECT precedent.nom_table, niveau - 1
FROM T_CONTRAINTES precedent
INNER JOIN T_TREE_CONTRAINTES debut
ON debut.table_a_supprimer = precedent.nom_table_pere
WHERE precedent.nom_table_pere <> precedent.nom_table)
SELECT DISTINCT *
FROM T_TREE_CONTRAINTES
ORDER BY niveau
qui permet de lister les tables à supprimer préalablement à une table
donnée
(@TABLE_NAME) dans la base donnée (@DB_NAME) et dans l'ordre !
A +
--
Frédéric BROUARD, MVP SQL Server. Expert SQL / spécialiste Delphi, web
Livre SQL - col. Référence : http://sqlpro.developpez.com/bookSQL.html
Le site du SQL, pour débutants et pros : http://sqlpro.developpez.com
************************ www.datasapiens.com *************************
Philippe T [MS] a écrit:
> Bonjour,
>
> Pour faire ses requêtes, rien ne vaut un bon query analyzer !!! :-)
>
> Phil.
> ________________________________________________________
> Philippe TROTIN http://blogs.msdn.com/ptrotin
> Microsoft Services France http://www.microsoft.com/france
>
> "Michel" <Michel@discussions.microsoft.com> wrote in message
> news:DF411EAD-C190-449F-83A8-EE8598853496@microsoft.com...
>
>>Merci David,
>>
>>Je venais de trouver la solution
>>en fait avec entrepise manager en SQL designer la commande CASE n'est
pas
>>acceptée...
>>
>>
>>
>>"David.V" a écrit :
>>
>>
>>>avec CASE :
>>>
>>>select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd -
>>>detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif'
END)...
>>>
>>>David
>>>
>>>"Michel" <Michel@discussions.microsoft.com> a écrit dans le message de
>>>news:F0852095-423F-4CA8-BE2C-11C511665221@microsoft.com...
>>>
>>>>Bonjour a tous,
>>>>
>>>>J'effectue une requete avec un calcul
>>>>
>>>>select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd
>
> as
>
>>>>solde
>>>>
>>>>je voudrais avoir la valeur du calcul si le résultat est positif et 0
>
> si
>
>>>il
>>>
>>>>est négatif !
>>>>
>>>>comment faire???
>>>>
>>>>Merci pour votre aide
>>>>
>>>>Michel
>>>
>>>
>>>
>
>
Je ne suis pas un fervent utilisateur des builders de requètes mais ces builders ne sont qu'une aide aux requêtes simples et ne remplace pas à mon avis une bonne connaissance du langage SQL.
Phil. ________________________________________________________ Philippe TROTIN http://blogs.msdn.com/ptrotin Microsoft Services France http://www.microsoft.com/france
"Fred BROUARD" wrote in message news:
Et philippe je vais me marrer car je me demande comment cette interface va permettre de réaliser graphiquement des requêtes récursives acceptée
maintenant
dans la v 2005, du genre :
WITH T_CONTRAINTES (nom_table, nom_table_pere) AS (SELECT DISTINCT CTU.TABLE_NAME, TCT.TABLE_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RFC INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE CTU ON RFC.CONSTRAINT_CATALOG = CTU.CONSTRAINT_CATALOG AND RFC.CONSTRAINT_SCHEMA = CTU.CONSTRAINT_SCHEMA AND RFC.CONSTRAINT_NAME = CTU.CONSTRAINT_NAME INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS TCT ON RFC.UNIQUE_CONSTRAINT_CATALOG = TCT.CONSTRAINT_CATALOG AND RFC.UNIQUE_CONSTRAINT_SCHEMA = TCT.CONSTRAINT_SCHEMA AND RFC.UNIQUE_CONSTRAINT_NAME = TCT.CONSTRAINT_NAME WHERE CTU.TABLE_CATALOG = @DB_NAME RECURSIVE T_TREE_CONTRAINTES (table_a_supprimer, niveau) AS (SELECT DISTINCT nom_table, 0 FROM T_CONTRAINTES WHERE nom_table_pere = @TABLE_NAME UNION ALL SELECT precedent.nom_table, niveau - 1 FROM T_CONTRAINTES precedent INNER JOIN T_TREE_CONTRAINTES debut ON debut.table_a_supprimer = precedent.nom_table_pere WHERE precedent.nom_table_pere <> precedent.nom_table) SELECT DISTINCT * FROM T_TREE_CONTRAINTES ORDER BY niveau
qui permet de lister les tables à supprimer préalablement à une table
donnée
(@TABLE_NAME) dans la base donnée (@DB_NAME) et dans l'ordre !
A +
-- Frédéric BROUARD, MVP SQL Server. Expert SQL / spécialiste Delphi, web Livre SQL - col. Référence : http://sqlpro.developpez.com/bookSQL.html Le site du SQL, pour débutants et pros : http://sqlpro.developpez.com ************************ www.datasapiens.com *************************
Philippe T [MS] a écrit: > Bonjour, > > Pour faire ses requêtes, rien ne vaut un bon query analyzer !!! :-) > > Phil. > ________________________________________________________ > Philippe TROTIN http://blogs.msdn.com/ptrotin > Microsoft Services France http://www.microsoft.com/france > > "Michel" wrote in message > news: > >>Merci David, >> >>Je venais de trouver la solution >>en fait avec entrepise manager en SQL designer la commande CASE n'est
pas
>>acceptée... >> >> >> >>"David.V" a écrit : >> >> >>>avec CASE : >>> >>>select (CASE WHEN (detbcmd.prixunit*detbcmd.qtcmd - >>>detbcmd.prixunit*detbliv.qtcmd)>=0 THEN 'Positif' ELSE 'Negatif'
END)...
>>> >>>David >>> >>>"Michel" a écrit dans le message de >>>news: >>> >>>>Bonjour a tous, >>>> >>>>J'effectue une requete avec un calcul >>>> >>>>select detbcmd.prixunit*detbcmd.qtcmd - detbcmd.prixunit*detbliv.qtcmd > > as > >>>>solde >>>> >>>>je voudrais avoir la valeur du calcul si le résultat est positif et 0 > > si > >>>il >>> >>>>est négatif ! >>>> >>>>comment faire??? >>>> >>>>Merci pour votre aide >>>> >>>>Michel >>> >>> >>> > >