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 |
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2007-12-08 : 16:32:00
|
| I have created a function with:set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER FUNCTION [dbo].[fn_concat_boxes](@item varchar, @week int)RETURNS VARCHAR(100)ASBEGINDECLARE @Output varchar(100)SELECT @Output = COALESCE(@Output + '/', '') + CAST(quantity AS varchar(5))FROM flexing_stock_transactionsWHERE item = @item AND week = @weekGROUP BY quantityORDER BY quantityRETURN @Output ENDhow can I pass the variable @item correctly for the string comparisonWHERE item = @item AND week = @weekto work correctly please?WHERE item = '@item' AND week = @weekwon't work andWHERE item = @item AND week = @weekwon't work. |
|
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2007-12-08 : 17:40:05
|
| Oops, typo error (liveware).Should have put ... (@item varchar(10), @week int)adding a varchar length brought it to life! Doh!!! |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-12-09 : 00:09:09
|
| What is the error message, if any?Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
|
|
|