[SIZE=2][COLOR=#0000ff]set[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ANSI_NULLS[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ON[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]set[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]QUOTED_IDENTIFIER[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ON[/COLOR][/SIZE]
[SIZE=2]GO[/SIZE]
[SIZE=2][COLOR=#008000]-- =============================================[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]-- Author: <Ryan Roberts>[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]-- Create date: <3-09-07>[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]-- Description: <Returns product image url for product search based on prefered child sku in department.>[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]-- =============================================[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]ALTER[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]FUNCTION[/COLOR][/SIZE][SIZE=2] [dbo][/SIZE][SIZE=2][COLOR=#808080].[/COLOR][/SIZE][SIZE=2][fn_ProductImageURL][/SIZE]
[SIZE=2][COLOR=#808080]([/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]-- Add the parameters for the function here[/COLOR][/SIZE]
[SIZE=2]@Sku [/SIZE][SIZE=2][COLOR=#0000ff]varchar[/COLOR][/SIZE][SIZE=2]COLOR=#808080[/COLOR][/SIZE]
[SIZE=2][COLOR=#808080])[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]RETURNS[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]varchar[/COLOR][/SIZE][SIZE=2]COLOR=#808080[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]AS[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]BEGIN[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]-- Declare the return variable[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]DECLARE[/COLOR][/SIZE][SIZE=2] @ResultVar [/SIZE][SIZE=2][COLOR=#0000ff]varchar[/COLOR][/SIZE][SIZE=2]COLOR=#808080[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]-- Add the T-SQL statements to compute the return value here[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]IF[/COLOR][/SIZE][SIZE=2][COLOR=#808080]([/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]SELECT[/COLOR][/SIZE][SIZE=2] PreferredChildSku [/SIZE][SIZE=2][COLOR=#0000ff]FROM[/COLOR][/SIZE][SIZE=2] product_HeaderDepartment [/SIZE][SIZE=2][COLOR=#0000ff]WHERE[/COLOR][/SIZE][SIZE=2] ProductSku [/SIZE][SIZE=2][COLOR=#808080]=[/COLOR][/SIZE][SIZE=2] @Sku[/SIZE][SIZE=2][COLOR=#808080])[/COLOR][/SIZE][SIZE=2][COLOR=#808080]!=[/COLOR][/SIZE][SIZE=2][COLOR=#808080]NULL[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]BEGIN[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]SELECT[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]top[/COLOR][/SIZE][SIZE=2]COLOR=#808080[/COLOR][/SIZE][SIZE=2] @ResultVar [/SIZE][SIZE=2][COLOR=#808080]=[/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]â~/App_Common/Images/Products/â[/COLOR][/SIZE][SIZE=2][COLOR=#808080]+[/COLOR][/SIZE][SIZE=2][COLOR=#ff00ff]REPLACE[/COLOR][/SIZE][SIZE=2]COLOR=#808080[/COLOR][/SIZE][SIZE=2][COLOR=#808080]+[/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]â_sm.jpgâ[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]FROM[/COLOR][/SIZE][SIZE=2] product_HeaderDepartment[/SIZE]
[SIZE=2][COLOR=#0000ff]WHERE[/COLOR][/SIZE][SIZE=2] ProductSku [/SIZE][SIZE=2][COLOR=#808080]=[/COLOR][/SIZE][SIZE=2] @Sku[/SIZE]
[SIZE=2][COLOR=#0000ff]END[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]ELSE[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]BEGIN[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]SELECT[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]top[/COLOR][/SIZE][SIZE=2]COLOR=#808080[/COLOR][/SIZE][SIZE=2] @ResultVar [/SIZE][SIZE=2][COLOR=#808080]=[/COLOR][/SIZE][SIZE=2] ImageFileSmall[/SIZE]
[SIZE=2][COLOR=#0000ff]FROM[/COLOR][/SIZE][SIZE=2] product_Header[/SIZE]
[SIZE=2][COLOR=#0000ff]WHERE[/COLOR][/SIZE][SIZE=2] ProductSku [/SIZE][SIZE=2][COLOR=#808080]=[/COLOR][/SIZE][SIZE=2] @sku [/SIZE]
[SIZE=2][COLOR=#0000ff]END[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]RETURN[/COLOR][/SIZE][SIZE=2] @ResultVar[/SIZE]
[SIZE=2][COLOR=#0000ff]END[/COLOR][/SIZE]
why isnt this working?