insert where not in

Posted on 2012-08-30
Last Modified: 2012-08-30
insert into table varcharColumn , int

where varcharValue is not in varcharColumn
Question by:rgb192
    LVL 65

    Accepted Solution

    INSERT INTO YourTable (colVarchar, colInt)
    SELECT SomeVarcharColumn, SomeIntColumn
    WHERE SomeVarcharColumn <> 'SomeVarcharValue'
    LVL 75

    Assisted Solution

    by:Aneesh Retnakaran
    INSERT INTO YourTable (colVarchar, colInt)
    SELECT SomeVarcharColumn, SomeIntColumn
    WHERE SomeVarcharColumn NOT IN (SELECT colVarchar From YourTable )

    Author Closing Comment


    both work

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
    Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    760 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

    7 Experts available now in Live!

    Get 1:1 Help Now