文字列形式の入力値があります(カンマで区切られています)。
customerID = "1,2,3,4,5"
cutomerID
これらの値を一時顧客テーブルの列に挿入するにはどうすればよいですか?
文字列形式の入力値があります(カンマで区切られています)。
customerID = "1,2,3,4,5"
cutomerID
これらの値を一時顧客テーブルの列に挿入するにはどうすればよいですか?
ありがとうデバート。これはもう 1 つの代替ソリューションです。私を助けてくれてありがとう。
DECLARE @customerID varchar(max) = Null ;
SET @customerID= '1,2,3,4,5'
DECLARE @tempTble Table (
customerID varchar(25) NULL);
while len(@customerID ) > 0
begin
insert into @tempTble (customerID ) values(left(@customerID , charindex(',', @customerID +',')-1))
set @customerID = stuff(@customerID , 1, charindex(',', @customerID +','), '')
end
select * from @tempTble