Author |
Topic |
Landie
Starting Member
8 Posts |
Posted - 2008-08-18 : 09:48:27
|
I have another stored proecedure where I always get this error : "Error 170 : line 25: Incorrect syntax near '''. (at least, that's where I think it mentions, the syntax near-part is not that clear to see).This is the stored procedure:SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO/* Record in KBODossier aanmaken Input: keyid klant, keyid hoofdonderneming (voor vestigingen), dossiertype, medewerker, persoonstypeOutput : dossiernr*/CREATE PROCEDURE ULNV_KBODossier @Keyid numeric(9,0), @KeyidHoofd numeric(9,0), @DossType int, @PersType varchar(3), @MDWNr numeric(9,0), @KBODossNr numeric(9,0) OUTPUTAS-- variabelenDECLARE @PersoonType intBEGINIF @PersType = 'NP' SET @PersoonType = 1IF @PersType = 'RP' SET @PersoonType = 2IF @PersType = 'VNP' SET @PersoonType = 4IF @PersType = 'VRP' SET @PersoonType = 5 INSERT INTO svf.dbo.KBODossier(KeyID, KeyidHoofd, DossType, IngaveDatum, Status, StatusID, StatusDatum, Medewerker, PersType) VALUES (@KeyID,@Keyidhoofd, @DossType, getdate(),’Nieuw’,1,getdate(),@MDWNr, @PersoonType)SET @KBODossNr = (SELECT KBODossnr FROM svf.dbo.KBODossier WHERE keyid = @Keyid and Medewerker = @MDWNr and dosstype = @DossType and PersType = @PersType)ENDGOThe strange thing is that if i delete the 4 if's, I still get the error but then on line 22 (the empty line just before BEGIN). |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-18 : 09:52:37
|
what are values you passed for variables? |
 |
|
Landie
Starting Member
8 Posts |
Posted - 2008-08-18 : 09:55:45
|
I haven't even executed this stored procedure. I get the errors when I check the syntax creating a stored procedure.If I would use the stored proecedure these would be possible variables :@Keyid : 40123256@KeyidHoofd : 41987352@DossType : 1@PersType : 'NP' or 'RP' or 'VRP' or 'VNP'@MDWNr : 19000123 |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-18 : 10:02:37
|
quote: getdate(),’Nieuw’,1
this aren't single quote '. It is `. Should use single quote to enclose the string KH[spoiler]Time is always against us[/spoiler] |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-18 : 10:03:30
|
replace your code with this and tryINSERT INTO svf.dbo.KBODossier(KeyID, KeyidHoofd, DossType, IngaveDatum, Status, StatusID, StatusDatum, Medewerker,PersType) VALUES (@KeyID,@Keyidhoofd, @DossType, getdate(),'Nieuw',1,getdate(),@MDWNr, @PersoonType) KH[spoiler]Time is always against us[/spoiler] |
 |
|
Landie
Starting Member
8 Posts |
Posted - 2008-08-18 : 10:08:13
|
That's the solution. I copied the stored procedure from a word document and I thought I've checked every ' but it seems I forgot one.thanks ! |
 |
|
|
|
|