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
Solved

MS SQL STORED PROCEDURE

Posted on 2011-09-07
3
232 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

856 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