SolvedPrivate

SSIS Package T-SQL

Posted on 2014-11-10
7
21 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:codedigger
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:codedigger
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 14

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 46

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

914 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

18 Experts available now in Live!

Get 1:1 Help Now