Steve7423
asked on
parameterized stored proc not working
I've worked with Access for over 10 years and I'm now learning the differences with SQL Server. I've created a stored proc that uses a parameter. for some reason it's not returning anything. If I remove the parameter I get data.
ALTER PROCEDURE [dbo].[GetCompanyNameParam ] (@cmpy nchar)
AS
BEGIN
SELECT company_venture from dbo.tbl_company where tbl_company.company_ventur e = @cmpy
END
right click the proc and select Execute stored procedure. the dialog comes up where you enter your parameter value. I type in the value that I know is in the field in the table and run it and it returns nothing.
I'm curious if the datatype is to blame. the type is a simple string, "MyCompany"
what m I doing wrong???
ALTER PROCEDURE [dbo].[GetCompanyNameParam
AS
BEGIN
SELECT company_venture from dbo.tbl_company where tbl_company.company_ventur
END
right click the proc and select Execute stored procedure. the dialog comes up where you enter your parameter value. I type in the value that I know is in the field in the table and run it and it returns nothing.
I'm curious if the datatype is to blame. the type is a simple string, "MyCompany"
what m I doing wrong???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:)
ASKER
Thanks. it worked. Now I know to set the length of data types, where as in Access you don't.