Link to home
Start Free TrialLog in
Avatar of Roberto Madro R.
Roberto Madro R.Flag for United States of America

asked on

SSIS Package T-SQL

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
Avatar of PortletPaul
PortletPaul
Flag of Australia image

What is the relevance of SSIS here?
Is that the exact error message?

I see no syntax problem in the query you have provided.
Avatar of Roberto Madro R.

ASKER

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.
Thanks, understood. Not sure how I can help further as we can both agree that the sql seen here is fine.
Hi,

Are you using any alias name for the where clause which will not be supported in the SQL
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?
>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.
ASKER CERTIFIED SOLUTION
Avatar of it_movies
it_movies

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial