SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Problems with parameters
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gbritton
Flowing Fount of Yak Knowledge

1538 Posts

Posted - 11/28/2013 :  10:06:56  Show Profile  Reply with Quote
I'm having a very elementary problem with parameters passed to an Execute SQL Task:

I have two parameters defined at the package level:

1. Input, type int32, value 1
2. Output type int32, value 0

In my task, I map the variable Input to the Parameters, direction input, type LONG, name 0.

Then in the Reslt Set, I define the variable Output, result name 0.

I put in a simple query:

Select 1


And set the result set to Single Row.

I added a script task afterwards to show the results in a message box.

I run the package and it works. I see '1' in the messagebox.

Now, the trouble begins! I changed the query to:

select ?


and used the same parameter and result set mappings. This time, however, the task fails with the error message:

quote:
[Execute SQL Task] Error: Executing the query "select ?" failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.


I'm totally stuck! Since the simpe 'select 1' works fine, I think I can rule out the suggestions regarding the resultset or connection. That leaves the parameters. I just can't see what the issue can be.

Any help would be greatly appreciated.

Edited by - gbritton on 11/28/2013 10:18:34

gbritton
Flowing Fount of Yak Knowledge

1538 Posts

Posted - 11/28/2013 :  16:27:47  Show Profile  Reply with Quote
More info on this:

From http://technet.microsoft.com/en-us/library/cc280502.aspx

quote:

SELECT, INSERT, UPDATE, and DELETE commands frequently include WHERE clauses to specify filters that define the conditions each row in the source tables must meet to qualify for an SQL command. Parameters provide the filter values in the WHERE clauses.



What this does NOT say is that you cannot substitute parameters anywhere else! Not even in a case statement (wouldn't that be nice?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 11/29/2013 :  00:50:38  Show Profile  Reply with Quote
its working fine for me

see attached pkg. just change the connection to your server and db and test

https://drive.google.com/file/d/0B4ZDNhljf8tQUnVveVlzZHhWa3M/edit?usp=sharing

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

gbritton
Flowing Fount of Yak Knowledge

1538 Posts

Posted - 11/29/2013 :  08:45:59  Show Profile  Reply with Quote
quote:
Originally posted by visakh16

its working fine for me

see attached pkg. just change the connection to your server and db and test




turns out the problem was the property ByPassPrepare was set to False. it was failing before the query was sent to the server!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 11/30/2013 :  01:48:03  Show Profile  Reply with Quote
quote:
Originally posted by gbritton

quote:
Originally posted by visakh16

its working fine for me

see attached pkg. just change the connection to your server and db and test




turns out the problem was the property ByPassPrepare was set to False. it was failing before the query was sent to the server!



ok that explains it

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000