为了账号安全,请及时绑定邮箱和手机立即绑定

SQL Server将CSV分成多行

SQL Server将CSV分成多行

Qyouu 2019-12-06 10:50:13
我知道之前曾有人问过这个问题,但由于某种原因我无法使其正常工作。我正在使用来自此SQL Team线程(第二篇文章)和以下查询的split函数。--This query converts the interests field from text to varcharselect    cp.id    ,cast(cp.interests as varchar(100)) as interestsinto #client_profile_tempfrom    client_profile cp--This query is supposed to split the csv ("Golf","food") into multiple rows            select    cpt.id    ,split.datafrom    #client_profile_temp cpt    cross apply dbo.split(    cpt.interests, ',') as split  <--Error is on this line但是我正在Incorrect syntax near '.'我在上面标记的错误。最后,我要ID              INTERESTS000CT00002UA    "Golf","food"成为ID              INTERESTS000CT00002UA    "Golf"000CT00002UA    "food"我正在使用SQL Server 2008,并将答案基于此StackOverflow问题。我对SQL还是很陌生,所以其他任何智慧的话也将不胜感激。
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 565 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信