Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Private
  • Views: 27
  • Last Modified:

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
0
Roberto Madro R.
Asked:
Roberto Madro R.
1 Solution
 
PortletPaulCommented:
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
 
Roberto Madro R.Programmer AnalystAuthor Commented:
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
 
PortletPaulCommented:
Thanks, understood. Not sure how I can help further as we can both agree that the sql seen here is fine.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Vikas GargBusiness Intelligence DeveloperCommented:
Hi,

Are you using any alias name for the where clause which will not be supported in the SQL
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>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
 
it_moviesCommented:
try this:

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

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now