SolvedPrivate

SSIS Package T-SQL

Posted on 2014-11-10
7
23 Views
Last Modified: 2016-02-11
Select A, B, C, D
From Table1
Where B NOT IN ('Tree','House', 'CAR','Truck')

I'm getting the error "The syntax for 'NOT' is incorrect,

what is so incorrect about it?

Your thoughts.

Thx
0
Comment
Question by:Roberto Madro R.
7 Comments
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40434010
What is the relevance of SSIS here?
Is that the exact error message?

I see no syntax problem in the query you have provided.
0
 

Author Comment

by:Roberto Madro R.
ID: 40434043
It's the SQL code inside the OLE DB Source on a SSIS package, I always opt to go with SQL for flexibility. As for "no syntax problem" that's my problem, I don't see what's wrong with the code because when I run the query from any of any of my  SQL tools, I get no error, it's only when it's in the package.
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40434077
Thanks, understood. Not sure how I can help further as we can both agree that the sql seen here is fine.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 15

Expert Comment

by:Vikas Garg
ID: 40434312
Hi,

Are you using any alias name for the where clause which will not be supported in the SQL
0
 
LVL 48

Expert Comment

by:Vitor Montalvão
ID: 40434501
Maybe this is a stupid question but are you sure that the error message is really relative to that command?
I mean, how do you know that isn't another command malformed in the package?
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40437324
>what is so incorrect about it?
First things that comes to mind is..
  Your SQL task is not correctly set up to a SQL connection that where this code would execute correctly.
  B is not a char column, which would result in a data type conversion.
  Just for kicks and giggles, execute this in SSMS and verify that it is correct.

Beyond that, it could really be anything, to include code immediately before this block, as SQL errors do not always reference the exact line that causes the error, and the exact error.

>I always opt to go with SQL for flexibility.
The counter-arguments against T-SQL in an SSIS package are..
   It can't be pre-compiled
   Impact Analysis is made more difficult as it's easy to search a database for all instances of B, but not as easy to search a database and all reports / packages that consume B.
0
 
LVL 1

Accepted Solution

by:
it_movies earned 500 total points
ID: 40437901
try this:

Where NOT B IN ('Tree','House', 'CAR','Truck')
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

830 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