Solved

Syntax error in SQL Select statement

Posted on 2007-11-21
3
171 Views
Last Modified: 2010-04-21
I am trying to do an inner join and get a syntax error on my select statement.  Here is the line

"Select * from PROVIDER INNER JOIN PHYSINS ON PROVIDER.PHYSICIAN_NPI = PHYSINS.PHYSICIAN_NPI WHERE (PHYINS.INSURANCE_CARRIER_NAME = @SearchInsur"

private String SearchProviderIns
    {
        get
        {
          //  String srchCmd = "Select * from PHYSINS";
          //  String srchCmd = "Select * from PHYSINS where INSURANCE_CARRIER_NAME = @SearchInsur AND PHYSICIAN_NPI in(SELECT PHYSICIAN_NPI FROM Provider)";
           // String InsurancesrchCmd = "Select * from PHYSINS where INSURANCE_CARRIER_NAME = @SearchInsur";
           
           
           
            String InsurancesrchCmd = "Select * from PROVIDER INNER JOIN PHYSINS ON PROVIDER.PHYSICIAN_NPI = PHYSINS.PHYSICIAN_NPI";
           
           
            // InsurancesrchCmd += ProviderSearch;

            if (txtSearchInsur.Text != "")
                //InsurancesrchCmd += " where INSURANCE_CARRIER_NAME = @SearchInsur";
                InsurancesrchCmd += " WHERE (PHYINS.INSURANCE_CARRIER_NAME = @SearchInsur";

            return InsurancesrchCmd;


Any ideas are greatly appreciated.


Thanks
Kenny
0
Comment
Question by:kwh3856
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
SQL_SERVER_DBA earned 500 total points
ID: 20329106
Select *
from PROVIDER INNER JOIN PHYSINS ON PROVIDER.PHYSICIAN_NPI = PHYSINS.PHYSICIAN_NPI
WHERE PHYINS.INSURANCE_CARRIER_NAME = @SearchInsur
0
 
LVL 16

Expert Comment

by:SQL_SERVER_DBA
ID: 20329128
or

"Select *
from PROVIDER INNER JOIN PHYSINS ON PROVIDER.PHYSICIAN_NPI = PHYSINS.PHYSICIAN_NPI
WHERE PHYINS.INSURANCE_CARRIER_NAME = '" & @SearchInsur & "'"
0
 

Author Closing Comment

by:kwh3856
ID: 31410407
Thanks a bunch!!!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now