-
Field name in stored procedure
Hi,
I`m fighting with a simple but annoying problem. I`ve tried to make a stored procedure
that would allow fast retrieval of weekly figures. Table looks like this:
NAME 01 02 52
----------------------- --------- --------- ---------
Corn 120 230 200
Oat 50 60 70
Cotton 60 80 90
I just wanted to run procedure WEEKLYVALUE with parameter (PRODUCTNAME, WEEK). But
how can I pass the week number to field list? The procedure below just fills an extra column
with the number of the supplied week.
CREATE PROC WEEKLYVALUES @PRODUCTNAME CHAR(10), @WEEK FLOAT AS
SELECT NAME, @WEEK FROM MYTABLE
WHERE
NAME=@PRODUCTNAME
GO
Is it possible to select fields of the table with stored procedure and parameters?
Perhaps with a little help from my friends...
Thanks,
Al
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|