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
 General SQL Server Forums
 New to SQL Server Programming
 how to update in this scenario?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

allan8964
Posting Yak Master

249 Posts

Posted - 09/24/2012 :  13:23:51  Show Profile  Reply with Quote
Hi there,

I have a table which has a field 'Code'. Code has text of 'http:// ...' Now I want to replace http:// to https:// and I tried to use

Update table1
Set Code = Replace(Code, 'http', 'https')


I got error from this. Then what should I do for this?

Thanks in advance.

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/24/2012 :  13:26:38  Show Profile  Reply with Quote
the statement looks fine. what was the error you got?


to make it more specific you can tweak it like

Update table1
Set Code = Replace(Code, 'http://', 'https://')


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

allan8964
Posting Yak Master

249 Posts

Posted - 09/24/2012 :  13:31:05  Show Profile  Reply with Quote
Thanks visakh16 for quick reply!
Error is 'Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.'
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/24/2012 :  13:37:08  Show Profile  Reply with Quote
nope the error has no relation to statement you posted!

post us full query. the error is due to some other query involved in the batch

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

allan8964
Posting Yak Master

249 Posts

Posted - 09/24/2012 :  13:44:29  Show Profile  Reply with Quote
I exported table1 to table2 and updaye table2 it worked. I checked table1 script found difference from tabtle2 is as follows:

CONSTRAINT [PK_Site] PRIMARY KEY CLUSTERED
(
[SiteId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

any of this blocked the operation?
Thanks.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/24/2012 :  15:31:40  Show Profile  Reply with Quote
sorry whatever you're telling doesnt make any sense

the above error has nothing to do with blocking

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

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