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 794199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:16:39+00:00 2026-05-14T22:16:39+00:00

I want to realize a query with the Visual Studio 2008 build in Query

  • 0

I want to realize a query with the Visual Studio 2008 build in Query Builder for a TableAdapter similar like following (MSSQL 2008):

select * from [MyDB].[dbo].[MyView] where UNIQUE_ID NOT IN ('MyUniqueID1','MyUniqueID2')

How do I have to set the Filter in my query in order to call it with the myTableAdapter.GetDataExceptUniqueIds(...) function?

I tried to set the filter to NOT IN (@ids) and called it with

string[] uniqueIds = ...;
myTableAdapter.GetDataExceptUniqueIds(String.Join("','", uniqueIds));

and with

StringBuilder sb = new StringBuilder("'");
sb.Append(String.Join("','", uniqueIds));
sb.Append("'");
return myTableAdapter.GetDataExceptUniqueIds(sb.ToString());

but both failed

  • 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-14T22:16:40+00:00Added an answer on May 14, 2026 at 10:16 pm

    You cannot use dynamic parameters in a SELECT … WHERE [NOT] IN list

    WORKAROUND:

    Create a table function, similar to the following function:

    CREATE FUNCTION dbo.ParmsToTable(@Parameters varchar(4000))
    returns @result TABLE (Value varchar(100))
    AS  
    begin
         DECLARE @pTable table
              (
              Value varchar(100)
              )
    
         DECLARE @Value varchar(100), @Pos int
    
         SET @Parameters = LTRIM(RTRIM(@Parameters))+ ','
         SET @Pos = CHARINDEX(',', @Parameters, 1)
    
         IF REPLACE(@Parameters, ',', '') <> ''
         BEGIN
              WHILE @Pos > 0
              BEGIN
                   SET @Value = LTRIM(RTRIM(LEFT(@Parameters, @Pos - 1)))
                   IF @Value <> ''
                   BEGIN
                        INSERT INTO @pTable (Value) VALUES (@Value) 
                   END
                   SET @Parameters = RIGHT(@Parameters, LEN(@Parameters) - @Pos)
                   SET @Pos = CHARINDEX(',', @Parameters, 1)
    
              END
         END    
         INSERT @result
         SELECT value
            FROM @pTable 
         RETURN
    END    
    

    and change your TableAdapter as follows:

    select * from [MyDB].[dbo].[MyView] where UNIQUE_ID NOT IN
    (select value from dbo.ParmsToTable(@p)  )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to realize a construct in MS SQL that would look like this
What I want to realize is the following: In a JSP x I have
Here is my query: SELECT dbo.EmailCampaignTracking.emailOpened, dbo.EmailCampaignTracking.emailUnsubscribed, dbo.EmailCampaignTracking.emailBounced, COUNT(*) FROM dbo.EmailCampaignTracking Group By dbo.EmailCampaignTracking.emailBounced,
I have a query that, basically, says this: SELECT DISTINCT [DB_ID] FROM [TableX] WHERE
I want to store short arrays in a field. (I realize there are reasons
i want to call a apex method from a custom Button I realise we
want to know why String behaves like value type while using ==. String s1
want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
I want to update rows of a table in a specific order, like one
I want to do a MySQL Query which selects a given number of Rows

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.