SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Execute SQL Task issue


Execute SQL Task issue

Author
Message
suresh.arumugham
suresh.arumugham
SSC Veteran
SSC Veteran (245 reputation)SSC Veteran (245 reputation)SSC Veteran (245 reputation)SSC Veteran (245 reputation)SSC Veteran (245 reputation)SSC Veteran (245 reputation)SSC Veteran (245 reputation)SSC Veteran (245 reputation)

Group: General Forum Members
Points: 245 Visits: 292
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
--boot

SELECT REPLACE(word,'oo','**') FROM #temp
--saat
--bat
--h**t
--b**t


You 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
erik.nelke 98967
erik.nelke 98967
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 10
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.
erik.nelke 98967
erik.nelke 98967
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 10
Hi,

I was able to execute the following in Management studio successfully but was unable to replicate the results when using BIDS.

Update dbo.mydatabase
Set stage = REPLACE(Stage,'Closed Won','Awarded')

I tried the table solution but was not able to achieve the desired results.
batgirl
batgirl
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1705 Visits: 1820
I may be missing something here, but why not just

update mydatabase
set stage = 'Awarded' where stage = 'Closed Won'
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search