Solved

Parameter substitution in DTS package

Posted on 2007-11-21
3
959 Views
Last Modified: 2013-11-30
I have a DTS package containing two global variables, FromEmailAccount and ToEmailAccount.  (These variables are set at design time to normal looking email addresses.)  

The package also contains an Execute SQL task.  Here is the code for the task:

      declare @FromEMailAccount nvarchar(255)
      declare @ToEMailAccount  nvarchar(255)

      set  @FromEMailAccount = ? --Global Variable 'FromEMailAccount' assigned here
      set  @ToEMailAccount  = ? --Global Variable 'ToEMailAccount' assigned here

      update CheckValues
      set
            CheckValStr1 = @FromEMailAccount,
            CheckValStr2 = @ToEMailAccount



When I try to parse the query in the Execute SQL Task Properties dialog, I get a cryptic error message saying "Syntax error, permission violation or other non-specific error".  I get a similar error when I try to use the Parameters button.  

In order to assign the input parameters, I used disconnected edit and set the InputGlobalVariableNames property to "FromEMailAccount";"ToEMailAccount".    

Unfortunately, when the code runs only the first character of the global variables values is written into the CheckValStr1 and CheckValStr2 fields.  Why?  
0
Comment
Question by:DrLechter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 500 total points
ID: 20336726
Does this work:

update CheckValues
      set
            CheckValStr1 = ?
            CheckValStr2 = ?

Are the global variables set the correct data types? You might want to use the Set Prpoerties task rather than a disconnected edit.

Lastly, this ~may~ help. It has some tricks you can use with parameters (when using SP's)

http://www.sqldts.com/234.aspx
0
 
LVL 4

Author Comment

by:DrLechter
ID: 20382004
Unfortunately, I couldn't solve this issue.   The article was interesting (I had already read it) but none of the infomration helped.  I wound up removing all the substituted parameters as a workaround.  Simpler is better in this case.

0
 
LVL 4

Author Closing Comment

by:DrLechter
ID: 31597117
I couldn't get it working.  But thanks for the effort anyhow!
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I find this data? 3 28
T-SQL Query - Group By Year 3 32
SQL Server Express or Standard? 5 33
Running Total Using new MS SQL Function 21 52
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

726 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