Solved

Syntax error in SQL Select statement

Posted on 2007-11-21
3
172 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Search by two fields at the same time using c# radio button 5 39
Host asp.net pages 5 25
Data is not showing from images 15 37
Replace &lt; with < 14 56
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

12 Experts available now in Live!

Get 1:1 Help Now