我知道之前曾有人問過這個問題,但由于某種原因我無法使其正常工作。我正在使用來自此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還是很陌生,所以其他任何智慧的話也將不勝感激。
SQL Server將CSV分成多行
Qyouu
2019-12-06 10:50:13