Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
| Search | Today's Posts | Mark Forums Read
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 19th, 2004, 06:46 PM
Authorized User
Join Date: Jul 2003
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using wildcard character in Stored Proc


Can anyone help in how do I use wildcard character in SQL Server Stored Proc. When I try to use the wildcard as '%@location%', it is read as a string. Here is the snippet of the code:

CREATE Procedure GetInquiryByLocFormat
        @loc varchar (25),
        @format varchar (50),
        @total integer OUTPUT
    SELECT @total = SUM(inquiry_assign)
    FROM tblRep
    WHERE (camp_loc LIKE '%@loc%' ) AND (cl_format LIKE '%@format%')

Any help will be appreciated

  #2 (permalink)  
Old March 19th, 2004, 07:02 PM
Friend of Wrox
Join Date: Jun 2003
Location: , , USA.
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts

'%' + @location + '%'


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Proc that returns a value elygp SQL Server 2000 4 May 9th, 2007 01:05 AM
Calling an insert stored proc from a select stored dzitam SQL Language 10 April 2nd, 2007 12:39 PM
How to get value from stored proc busybee ASP.NET 1.0 and 1.1 Basics 4 April 2nd, 2006 01:06 AM
optional where in stored proc david_ste SQL Server ASP 2 October 27th, 2005 07:16 AM
How i can OUTPUT in Stored Proc yoord SQL Server 2000 2 July 19th, 2004 03:11 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.