Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stored Procedure Trouble
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00596982
Message ID:
00597296
Vues:
14
Hi Matt,

IN T-SQL you've to use BEGIN/END to mark statement block. Try corrections highlited below
>
>How many records would you get if select is run from QA?
		Select distinct * from OGC
>			WHERE OGC.OGCID Between 10000 and 29999
>			order by businessname,lastname,firstname
>
>>I'm sorry, that is just the original code I had in there, here is the code as it stands now and it still does not return anything for the usertypes ADMIN and CSR.
>>
>
>>CREATE PROCEDURE sp_getAllOGCs
>>	@LoginName varchar(20)
>>AS
>>
>>set nocount on
>>
>>If Len(@LoginName)=0
>>	Select distinct * From OGC order by businessname,lastname,firstname
>>Else
      <b>BEGIN</b>
>>	Declare @UserType varchar(10)
>>
>>	SELECT    @UserType= OLUserType FROM OutbackLogin WHERE (OLUserName = @LoginName)
>>	If @UserType='TM'
>>	/* Grab all of the Territory Managers' OGC's */
>>		select distinct * from OGC inner join
>>			OutbackLogin ON OGC.TERRMGRID = OutbackLogin.OLUserID
>>			WHERE (OutbackLogin.OLUserName = @LoginName)
>>			order by businessname,lastname,firstname
>>	Else If @UserType='OGC'
>>	/* Grab the single OGC information - This should work the same as the Load method of the DB object */
>>		select distinct * from OGC inner join
>>			OutbackLogin ON OGC.OGCID = OutbackLogin.OLUserID
>>			WHERE (OutbackLogin.OLUserName = @LoginName)
>>			order by businessname,lastname,firstname
>>	Else If @UserType='CSR' OR @UserType = 'ADMIN'
>>	/* Grab all of the OGC's*/
>>		Select distinct * from OGC
>>			WHERE OGC.OGCID Between 10000 and 29999
>>			order by businessname,lastname,firstname
>>	Else
>>		Select distinct * From OGC order by businessname,lastname,firstname
     <b>END</b>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform