Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MS SQL STORED PROCEDURE

Posted on 2011-09-07
3
Medium Priority
?
254 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

618 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