Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-02-24 : 09:34:35
|
| Peter writes "SQL Server 2000 (Desktop), Win XP Pro SP2Keep getting an error on function:"ADO ERROR: Incorrect systax line 13 near '='I just can't seem to get the syntax right for the WHERE statement combined with a CASE statement and my parameter @ManufacturerIDMy intention with the query is to show all rows if @ManufacturerID = 0, otherwise limit rows to ManufacturerID=@ManufacturerIDMy thanks in advance..ALTER FUNCTION dbo.fnCustomerHistory(@ManufacturerID int)RETURNS TABLEASRETURN ( SELECT PreferredCustomerID, ManufacturerID, SaleComplete, ProductDescriptionFROM dbo.qryPurchaseItemWHERE CASE WHEN @ManufacturerID = 0 THEN ManufacturerID = ManufacturerID ELSE ManufacturerID = @ManufacturerID END )" |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-02-24 : 09:50:18
|
change your where towhere ManufacturerID = @ManufacturerIDor @ManufacturerID = 0 ----------------------------------'KH'It is inevitable |
 |
|
|
|
|
|