Please help me with my sproc. I have this code:
But then nothing is retrieved. I have read in an article that this is not the right way to pass @code with IN. But I don't know how to correct this.Code:ALTER PROCEDURE [dbo].[Sales by CustSummary] @code varchar(500), @fromdate date, @todate date AS BEGIN SET NOCOUNT ON; SELECT [Sales].[TransDate],[Sales].[StoreCode],[Branch].[Description], [Sales].[Product ID], [Sales].[Units],[Sales].[Price] FROM [Sales],[ Branch] WHERE [Sales].[StoreCode]=[Branch].[StoreCode] and [Sales].[StoreCode] in (@code) and [TransDate] between @fromdate and @todate END
@code has multiple items thats why i cant use =(equals) or assign.
I hope you can help me. Thnx!
Try this (untested):
Code:ALTER PROCEDURE [dbo].[Sales by CustSummary] (@code varchar(500), @fromdate date, @todate date ) AS BEGIN SET NOCOUNT ON; SELECT [Sales].[TransDate],[Sales].[StoreCode],[Branch].[Description], [Sales].[Product ID], [Sales].[Units],[Sales].[Price] FROM [Sales],[ Branch] WHERE [Sales].[StoreCode]=[Branch].[StoreCode] and [Sales].[StoreCode] in (@code) and [TransDate] between @fromdate and @todate END
its not valid in ms sql server declaration...
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks