Solved

MS SQL STORED PROCEDURE

Posted on 2011-09-07
3
248 Views
Last Modified: 2012-05-12
Hi guys
The code below produces an error
I am trying to retrieve selecred customers with a stored procedure
Can someone show me the right code
thanks
Dory

CREATE PROCEDURE Findcustomer
@strcust VARCHAR (10)
AS
SELECT cust_no,co_name,city,zip
FROM customer
WHERE co_name LIKE = '%@cust%'
GO
0
Comment
Question by:dory550
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 39

Expert Comment

by:appari
ID: 36500960
CREATE PROCEDURE Findcustomer
@strcust VARCHAR (10)
AS
SELECT cust_no,co_name,city,zip
FROM customer
WHERE co_name LIKE = '%' + @strcust  + '%'
GO
0
 
LVL 39

Accepted Solution

by:
appari earned 500 total points
ID: 36500962
try this (forgot to remove =)

CREATE PROCEDURE Findcustomer
@strcust VARCHAR (10)
AS
SELECT cust_no,co_name,city,zip
FROM customer
WHERE co_name LIKE '%' + @strcust  + '%'
GO
0
 

Author Closing Comment

by:dory550
ID: 36500996
Thanks for your help
Dory
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question