惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
B
Blog
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
Jina AI
Jina AI
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
L
LangChain Blog
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
酷 壳 – CoolShell
酷 壳 – CoolShell
Y
Y Combinator Blog
F
Fortinet All Blogs
H
Help Net Security
B
Blog RSS Feed
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题

博客园 - 破曉之陽

SQL 查找某年某月的天数 SQL操作全集 创建触发器和使用示例(于海涛 老师的实验课) 因为没工作了。所以的复习一下以前的东西。好去面试 SQL Server性能优化 应用Profiler优化SQL Server数据库系统 SQL CASE - 破曉之陽 - 博客园 SQL EXISTS - 破曉之陽 - 博客园 SQL 刪除相同的記錄 80048820 - 破曉之陽 - 博客园 奇怪的问题。 - 破曉之陽 - 博客园 如何在 Windows 2000 中提升和降级域控制器 Microsoft.Exchange.OMA.PreferencingServerResources.Resources.dll.EN 指定的網域的名稱或安全性識別碼(用磁碟映像檔部署的電腦無法加入AD網域 ) Microsoft.NET框架程序设计(修订版) 下载地址 将这个字段中所有含‘北京’的替换成'上海' 电脑自动重启 演练:使用受保护的配置加密配置信息 vs c#2005 web编程中的.cs文件为什么都没有namespace?
SQL left,RIGHT,CHARINDEX 使用示例
破曉之陽 · 2008-04-26 · via 博客园 - 破曉之陽

問:
表結構:
name       company    company_address      url1                
---------- ---------- -------------------- --------------------
Joe        ABC        Work   Lane          abc.com;xyz.com
Jill       XYZ        Job   Street         abc.com;xyz.com
寫一個存儲過程等到如下的結果:
name       company    company_address      url1                
---------- ---------- -------------------- --------------------
Jill       XYZ        Job   Street         abc.com
Jill       XYZ        Job   Street         xyz.com
Joe        ABC        Work   Lane          xyz.com
Joe        ABC        Work   Lane          abc.com
答:

drop   table   users1
go
create   table   users1   (name   varchar(10),company   varchar(10),company_address   varchar(20),url1   varchar(20))
insert   into   users1
select   'Joe ''ABC ''Work   Lane ''abc.com;xyz.com '
union   all   select   'Jill ''XYZ ''Job   Street ''abc.com;xyz.com '
drop   proc   up_test
go
create   proc   up_test
as
if   exists(select   1   from   sysobjects   where   type= ''   and   name= 'users2 ')
drop   table   users2
select   *   into   users2  
from   (
select  [name],company,company_address,left(url1,charindex';',url1)-1)   as   url1
from   users1
union   all
select   [name],company,company_address,right(url1,len(url1)-charindex';',url1)+1)  as   url1
from   users1) t
order   by   t.name,t.company,t.company_address
GO
exec   up_test
select   *   from   users2