0

I have database records to store page urls but we have problem in deployment the developer using localhost to store page filed in database because of that we end up with

http://localhost:8080/wow/page1.aspx  
http://localhost:8080/wow/page2.aspx
http://localhost:8080/wow/page3.aspx

just wondering can i write Tsql to loop throw record to remove the localhost from url and updating the new url

4

2 回答 2

2

你不需要循环,一个简单的 UPDATE 就可以了。例如

UPDATE WEB_TABLE SET URL_FIELD = REPLACE(URL_FIELD, 'localhost:8080', 'www.mysite.com')
于 2013-08-22T02:27:27.703 回答
-1

您可以使用 replace 方法执行 SQL 更新查询。

UPDATE [your table] SET [your field] = REPLACE([your field],'http://localhost:8080','')

这将一口气更新它们。

或者,如果你想循环,你可以使用 CURSOR

于 2013-08-22T02:28:57.360 回答