Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3352666
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:03:27+00:00 2026-05-18T02:03:27+00:00

hey guys im creating a stored procedure for search form in the asp.net im

  • 0

hey guys im creating a stored procedure for search form in the asp.net im getting error, code is given below

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[sp_searchcustomervendordetails] 
 @customervendortype varchar(30)=Null,
    @customervendorid   varchar(30)=Null,
    @customervendorname varchar(30)=Null,
    @state              varchar(30)=Null,
    @city               varchar(30)=Null
AS
BEGIN
 SET NOCOUNT ON;
--if @customervendortype is not null and len(@customervendortype)=0 set @customervendortype = null
--if @customervendorid is not null and len(@cuatomervendorid)=0 set @customervendorid = null
--if @customervendorname is not null and len(@customervendorname)=0 set @customervendorname = null
--if @city is not null and len(@city)=0 set @city = null
--if @state is not null and len(@state)=0 set @state = null

    -- Insert statements for procedure here
SELECT     CustomerVendorDetails.customervendorid AS CustomerVendorID,CustomerVendorAddressDetails.customervendorname, CustomerVendorAddressDetails.doorno, CustomerVendorAddressDetails.street, 
           CustomerVendorAddressDetails.city, CustomerVendorAddressDetails.state, CustomerVendorAddressDetails.country, 
           CustomerVendorAddressDetails.pincode,  CustomerVendorDetails.decidingauthority, 
           CustomerVendorDetails.landlineno1, CustomerVendorDetails.landlineno2, CustomerVendorDetails.faxno, ContactPersonDetails.contactno, 
           ContactPersonDetails.designation
FROM       CustomerVendorDetails INNER JOIN
           CustomerVendorAddressDetails ON CustomerVendorDetails.customervendorid = CustomerVendorAddressDetails.customervendorid INNER JOIN
           ContactPersonDetails ON CustomerVendorAddressDetails.customervendorid = ContactPersonDetails.customervendorid
WHERE      (@customervendortype is null or customervendortype like @customervendortype)
        or (@customervendorid is null or customervendorid like @customervendorid) 
        or (@customervendorname is null or customervendorname like @customervendorname)
        or (city is null or city like @city)
        or (state is null or state like @city)
END

im getting this error

Msg 209, Level 16, State 1, Procedure sp_searchcustomervendordetails, Line 34
Ambiguous column name 'customervendorid'.
Msg 209, Level 16, State 1, Procedure sp_searchcustomervendordetails, Line 35
Ambiguous column name 'customervendorname'

can any help me please

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:03:28+00:00Added an answer on May 18, 2026 at 2:03 am

    In general, you’ll get an “ambiguous column name” error when you’re performing a select that joins multiple tables together that have at least one column with the same name, and then you reference that column without prefixing it with the table.

    So I your case I would assume that the customervendorname column appears in more than one table (perhaps CustomerVendorDetails and CustomerVendorAddressDetails?) so when you use it in the where clause you’ll need to prefix it with the table name. I see in fact that you’ve already done this in the list of columns to be selected; you just need to do the same throughout the statement.

    Thus

    WHERE (@customervendortype is null or
           customervendortype like @customervendortype)
    

    needs to become

    WHERE (@customervendortype is null or
           CustomerVendorAddressDetails.customervendortype like @customervendortype)
    

    and possibly similar changes for the other constraints.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey guys I have the follow code in js: $(document).ready(function(){ $(.replyLink).click(function(){ $(#form-to-+this.id).html(htmlForm()).toggle(500); return false;
Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
Hey guys (and gals) I'm having a problem using Assembly GetExportedTypes() in .NET 4.0.
Hey guys, I'm creating a DLL in C++ and I want it to be
Hey guys, here is my code. int main() { char buffer[BUFSIZE]; // define our
Hey guys I'm creating a quick mysql file to create a DB with some
Hey guys... I'm working on creating one of my first websites and currently have
Hey guys, so I am creating a List(Of String), always of size 9. This
Hey guys I'm following the rails tutorial found here http://net.tutsplus.com/tutorials/ruby/the-intro-to-rails-screencast-i-wish-i-had/ and I've gotten to
Hey guys, I'm creating a comment box and I want to do two stuff

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.