Solved

Parameter substitution in DTS package

Posted on 2007-11-21
3
954 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
  • 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

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

Suggested Solutions

Title # Comments Views Activity
SQL Server - Copy database from one server to another 3 30
backup and restore 21 29
SQL, add where clause 5 23
SQLCMD Syntax 2 13
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how the fundamental information of how to create a table.

856 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