Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Incorrect syntax near 'NULL'
Message
De
07/01/2011 10:19:16
 
 
À
07/01/2011 10:17:38
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01495141
Message ID:
01495147
Vues:
35
>>I know there is a way to display what the final value of @sSQL, but can't remember it. Can someone tell me how, please? Also, if you can spot what my syntax error is that would be great too!
>>
>>
>>Frank, I can't immediately spot the syntax error - however, if you also place a SELECT @sSql at the end of the proc, the procedure will return the string...so you could use that in testing to bring back the value of @sSQL, and perhaps help in your debugging.
>
>Thanks Kevin,
>
>as I posted it I remembered the PRINT command so I added PRINT @sSQL and this came out:
>
>
SELECT [CommissionPK], 
>					[CommissionsPaid].[Amount],
>					[ChequeNumber],
>					[ChequeDate],
>					[ReceiptNumber],
>					[ReceiptDate], 
>					[ReceiptPK],
>					[AgentNumber],
>					[FirstName],
>					[MiddleName],
>					[LastName],
>					[AgentPK]
>				FROM CommissionsPaid 
>					inner join ReceiptDetails on ReceiptDetailFK = ReceiptDetailPK 
>					inner join Receipts on ReceiptFK = ReceiptPK
>					inner join Agents on AgentFK = AgentPK
>					LEFT OUTER JOIN Cheques ON [ChequeFK] = [ChequePK] 
>WHERE 1 = 1
>   AND ([LastName] LIKE @AgentName
>   AND [ChequeNumber] IS NOT NULL
>Msg 102, Level 15, State 1, Line 24
>Incorrect syntax near 'NULL'.
>
>Can you see anything wrong with that?

Got it! Missing bracket after @AgentName!
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform