Solved

Syntax error in SQL Select statement

Posted on 2007-11-21
3
175 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
[X]
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
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Format Date fields 11 64
Database maintenance 36 141
C# LINQ query question 11 33
web api controller with multiple posts that accept different objects 1 25
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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