Execution procedure stockée sur un select
Fermé
thiouraye
Messages postés
7
Date d'inscription
mardi 12 juillet 2011
Statut
Membre
Dernière intervention
20 juillet 2011
-
20 juil. 2011 à 13:59
thiouraye Messages postés 7 Date d'inscription mardi 12 juillet 2011 Statut Membre Dernière intervention 20 juillet 2011 - 20 juil. 2011 à 16:50
thiouraye Messages postés 7 Date d'inscription mardi 12 juillet 2011 Statut Membre Dernière intervention 20 juillet 2011 - 20 juil. 2011 à 16:50
A voir également:
- Execution procedure stockée sur un select
- Erreur d'execution 1004 - Forum Programmation
- Le point d'entrée de procédure bcrypt hash ✓ - Forum Logiciels
- Erreur d'execution '1004' ✓ - Forum VB / VBA
- Please select boot device - Forum Matériel & Système
- Processus d'execution client serveur - Forum Windows 10
2 réponses
Si j'ai bien compris c'est un truc comme ça que tu veux. Tu peux créer une fonction
CREATE FUNCTION cherche_id (@emailprof nvarchar (50), @password nvarchar(50))
returns int
as
begin
declare @identifiant int
if ((SELECT count(*) FROM table1 WHERE emailprof = @emailprof and password = @password) >0)
set @identifiant = (SELECT top 1 id_1,1 as espace FROM table1 WHERE emailprof = @emailprof and password = @password)
if ((SELECT count(*) FROM table2 WHERE emailprof = @emailprof and password = @password) >0)
set @identifiant = (SELECT top 1 id_2,2 as espace FROM table2 WHERE emailprof = @emailprof and password = @password)
if ((SELECT count(*) FROM table1 WHERE emailprof = @emailprof and password = @password) >0)
set @identifiant = (SELECT top 1 id_3,3 as espace FROM table3 WHERE emailprof = @emailprof and password = @password)
else
set @identifiant = 0
return @identifiant
end
CREATE FUNCTION cherche_id (@emailprof nvarchar (50), @password nvarchar(50))
returns int
as
begin
declare @identifiant int
if ((SELECT count(*) FROM table1 WHERE emailprof = @emailprof and password = @password) >0)
set @identifiant = (SELECT top 1 id_1,1 as espace FROM table1 WHERE emailprof = @emailprof and password = @password)
if ((SELECT count(*) FROM table2 WHERE emailprof = @emailprof and password = @password) >0)
set @identifiant = (SELECT top 1 id_2,2 as espace FROM table2 WHERE emailprof = @emailprof and password = @password)
if ((SELECT count(*) FROM table1 WHERE emailprof = @emailprof and password = @password) >0)
set @identifiant = (SELECT top 1 id_3,3 as espace FROM table3 WHERE emailprof = @emailprof and password = @password)
else
set @identifiant = 0
return @identifiant
end
thiouraye
Messages postés
7
Date d'inscription
mardi 12 juillet 2011
Statut
Membre
Dernière intervention
20 juillet 2011
1
20 juil. 2011 à 16:50
20 juil. 2011 à 16:50
Merci Aby, je vais tester ta solution et je te tiendrais au courant.