﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / Business Intelligence  / Execute SQL Task issue / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 06:19:30 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>I may be missing something here, but why not just update mydatabaseset stage = 'Awarded' where stage = 'Closed Won'</description><pubDate>Tue, 12 Feb 2013 12:52:56 GMT</pubDate><dc:creator>batgirl</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>Hi,I was able to execute the following in Management studio successfully but was unable to replicate the results when using BIDS. Update dbo.mydatabaseSet stage = REPLACE(Stage,'Closed Won','Awarded')I tried the table solution but was not able to achieve the desired results.</description><pubDate>Tue, 12 Feb 2013 12:38:38 GMT</pubDate><dc:creator>erik.nelke 98967</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>Thank you and all who responded. I had to break away for a lenghty meeting and will being trying the solutions in a bit. I'll report back the results.</description><pubDate>Tue, 12 Feb 2013 10:30:05 GMT</pubDate><dc:creator>erik.nelke 98967</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>Hey Erik,I created a table #temp with one field. I inserted four rows in it. Then tried the replace statement as you did.CREATE TABLE #temp ( word VARCHAR(100))SELECT * FROM #temp--saat--bat--hoot--bootSELECT REPLACE(word,'oo','**') FROM #temp--saat--bat--h**t--b**tYou must use the column name ( word in my table) in 1st expression, then the pattern (in singlequotes) in 2nd expression and the replace string pattern(in single quotes) in 3rd expression.Hope this helps !!!Regards,Suresh</description><pubDate>Tue, 12 Feb 2013 07:51:59 GMT</pubDate><dc:creator>suresh.arumugham</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>What do you want the SQL task to do? Update the column?If so the SQL needs to beUpdate [i]table_name[/i]Set stage = REPLACE(Stage,'Closed Won','Awarded')Mack</description><pubDate>Tue, 12 Feb 2013 07:45:29 GMT</pubDate><dc:creator>Mackers</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>Hi,I was able to get it to run with out error using calvo's statement and also Mack's statement. The only issue is that the value of Closed Won is not being replaced with Awarded.</description><pubDate>Tue, 12 Feb 2013 07:41:40 GMT</pubDate><dc:creator>erik.nelke 98967</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>The REPLACE statement doesn't update the table for you.  All it does is return the first expression but with any occurrence of the second expression replaced by the third expression.  If you want to update your table then you need to put your REPLACE statement into an UPDATE statement.John</description><pubDate>Tue, 12 Feb 2013 07:30:41 GMT</pubDate><dc:creator>John Mitchell-245523</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>Your SQL statement needs to be a proper statement ieSelect REPLACE(Stage,'Closed Won','Awarded')from [i]your_table[/i]What are you trying to do?  An update?  Assign a variable?Mack</description><pubDate>Tue, 12 Feb 2013 07:27:59 GMT</pubDate><dc:creator>Mackers</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>Hi Mack,I attached a screen shot from SSIS which shows the statement. Stage is the correc col. name.</description><pubDate>Tue, 12 Feb 2013 07:24:01 GMT</pubDate><dc:creator>erik.nelke 98967</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>[code="sql"]REPLACE ( string_expression , string_pattern , string_replacement )[/code][code="sql"]SELECT REPLACE ( 'closed won' , 'closed won', 'award')[/code]the string_expression can be a column, variable, or string.</description><pubDate>Tue, 12 Feb 2013 07:21:55 GMT</pubDate><dc:creator>calvo</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>Can ou post all of your query - also the column name is [stage] right?Mack</description><pubDate>Tue, 12 Feb 2013 07:20:43 GMT</pubDate><dc:creator>Mackers</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>Hi Mack,Thank you for the reponse. I used the statement and it returned the following.[Execute SQL Task] Error: Executing the query "REPLACE(Stage,'Closed Won','Awarded')" failed with the following error: "Incorrect syntax near 'Stage'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.</description><pubDate>Tue, 12 Feb 2013 07:18:21 GMT</pubDate><dc:creator>erik.nelke 98967</dc:creator></item><item><title>RE: Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>REPLACE(Stage,'Closed Won','Awarded')Mack</description><pubDate>Tue, 12 Feb 2013 07:13:48 GMT</pubDate><dc:creator>Mackers</dc:creator></item><item><title>Execute SQL Task issue</title><link>http://www.sqlservercentral.com/Forums/Topic1418947-147-1.aspx</link><description>I am trying to use the REPLACE function with no success. I have a Column name "Stage". In the column I need to find the value "Closed Won" and replace it with the value of "Awarded".I've tried variations of this statement but this is the jist of it.REPLACE("Closed Won","Closed Won","Awarded")It stops with the following erorr which has proven to be little help.[Execute SQL Task] Error: Executing the query "REPLACE("Closed Won","Closed Won","Awarded")" failed with the following error: "Incorrect syntax near 'Closed Won'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.Thank you for your help.Erik</description><pubDate>Tue, 12 Feb 2013 07:09:31 GMT</pubDate><dc:creator>erik.nelke 98967</dc:creator></item></channel></rss>