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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Passing Parameters to SQL Server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-02-09 : 08:44:20
Joel writes "I am having a problem passing parameter values to the stored procedure. The stored procedure is linked to crystal reports and I desperately need to know if the problem is with the stored procedure or crystal. Please be kind enough to check my stored procedure code and let me know if it is correct.

Thanks in advance,
Joel

CREATE PROCEDURE [dbo].[StockCountSheet]

@PARAM AS VARCHAR(500),
@PARAM2 AS VARCHAR(500)

AS

SET TEXTSIZE 2147483647

DECLARE @SQL AS VARCHAR(4499)

SET @SQL = 'SELECT dbo.Stock_Take_Listing.Product_Code AS Code,
dbo.Product_Details.Brand_Name + '' '' + dbo.Product_Details.Description + '' '' + CASE WHEN CONVERT(NVARCHAR(20),
ISNULL(Product_Details.Unit_Size, 0)) = 0 THEN ISNULL(Product_Details.Unit_of_Measure, '''') ELSE CONVERT(NVARCHAR(20),
ISNULL(Product_Details.Unit_Size, 0)) + ''x'' + ISNULL(Product_Details.Unit_of_Measure, '''') END AS Description, Location_Details.Location_Name
FROM dbo.Stock_Take_Listing INNER JOIN
dbo.Location_Details ON Stock_Take_Listing.Location_No = Location_Details.Location_No INNER JOIN
dbo.Product_Details ON dbo.Stock_Take_Listing.Product_Code = dbo.Product_Details.Product_Code
WHERE (dbo.Stock_Take_Listing.Sheet_No = '+' ' + @PARAM2 + ' ' +') AND
dbo.Location_Details.Branch_No = dbo.Stock_Take_Listing.Branch_No AND
dbo.Stock_Take_Listing.User_Name = '+' '+ @PARAM +' ' +'
AND dbo.Product_Details.Product_Code = dbo.Stock_Take_Listing.Product_Code
ORDER BY Product_Details.[Description] ASC'
EXEC(@SQL)
GO"

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2004-02-09 : 09:04:49
What's the error message?
Go to Top of Page
   

- Advertisement -