Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error near ',' error
Message
 
 
À
02/10/2012 09:03:24
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01554072
Message ID:
01554130
Vues:
42
>>>Hello all
>>>
>>>In the following SP, I'm getting an "Error near ',' " error - which is just about as descriptive as "black cat at night"
>>>@TestSub = '21'
>>>@TestSection = 'L'
>>>
>>>The command from Fox is
>>>
>>>ms1 = SQLExec(Thisform.r_conn, m.sqlcmd + m.param1)
>>>
>>>Where
>>>m.sqlcmd = "Execute CreateSubFile" and
>>>m.param1 = "?Thisform.r_TestSection, ?Thisform.r_Testfile"
>>>
>>>If I execute the SP - it runs just fine. What am I not seeing?
>>>
>>>
>>>ALTER PROCEDURE [dbo].[CreateSubFile]
>>>    @TestSection	nchar(1),
>>>    @TestSub	nchar(1)
>>>	
>>>ASBEGIN
>>>  declare @iError int, @iRowCnt int
>>>  -- SET NOCOUNT ON added to prevent extra result sets from
>>>  -- interfering with SELECT statements.
>>>  SET NOCOUNT ON;
>>>  select SubID = 0, Category, CorrectResp, Stem, RespA, RespB, RespC, RespD, OrigItmID
>>>        into #SubFile from CATMaster 
>>>        where 1 = 0
>>>	
>>>  if @TestSection = 'L'
>>>      Insert into #Subfile select SubID = MasterID, Category, CorrectResp, Stem, 
>>>        RespA, RespB, RespC, RespD, OrigItmID
>>>        from CATMaster 
>>>        where MasterID in (Select CatID from CATStats where subbank = @TestSub)
>>>        and Category in ('40','41')
>>>  else
>>>      insert into #Subfile select SubID = MasterID, Category, CorrectResp, Stem, RespA, RespB, RespC, RespD, OrigItmID
>>>        from CATMaster 
>>>        where MasterID in (Select CatID from CATStats where subbank = @TestSub)
>>>        and Category >= '50'
>>>    
>>>  select @iError = @@error, @iRowCnt = @@rowcount
>>>    
>>>  if @iError > 0
>>>      begin
>>>        raiserror('Error on Insert into Invoice -  %d',16,1, @iError) 
>>>         --Set @MsgErr = 'Error on Insert into Mastere -  %d'
>>>      end
>>>END
>>>
>>
>>ms1 = SQLExec(Thisform.r_conn, m.sqlcmd + m.param1)
>>
>>That would product "Execute CreateSubFile?Thisform.r_TestSection, ?Thisform.r_Testfile"
>>Don't you want a space after CreateSubFile?
>>Also, are you passing 3 arguments to two parameters?
>
>Actually, there are 3 parameters, apparently I grabbed an old copy of the SP after I'd made that change.
>But the lack of a space on m.param1 just might be the issue, I'll check it.
>
>**Update - Ok, error message went away, SP is running with no errors but #Subfile is not being created.

The temp table created in the SP can only be visible by that SP or procedures called from that SP. So, what do you mean by temp table not created?
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform