August 13, 2018 at 9:48 am
Hello everyone
Who has an idea please about the exact error of the STRING_SPLIT commandCREATE TABLE [dbo].[StagingTable](
[ProductId] [varchar](50) NOT NULL,
[PartsList] [varchar](1000) NOT NULL
)
GO
INSERT INTO dbo.StagingTable
(ProductId,PartsList)
VALUES
(1,'463|914|771|281|418'),
(2,'422|453'),
(3,'323|724|449|882|591|715')
select * from StagingTable
cross apply STRING_SPLIT(PartsList,'|')
while the requested result is following1 463
1 914
1 771
1 281
1 418
2 422
2 453
3 323
3 449
3 882
3 591
3 715
thanks
August 13, 2018 at 9:50 am
joujousagem2006 1602 - Monday, August 13, 2018 9:47 AM
Hello everyone
Who has an idea please about the exact error of the STRING_SPLIT commandCREATE TABLE [dbo].[StagingTable](
[ProductId] [varchar](50) NOT NULL,
[PartsList] [varchar](1000) NOT NULL
)
GOINSERT INTO dbo.StagingTable
(ProductId,PartsList)
VALUES
(1,'463|914|771|281|418'),
(2,'422|453'),
(3,'323|724|449|882|591|715')
select * from StagingTable
cross apply STRING_SPLIT(PartsList,'|')while the requested result is following
1 463
1 914
1 771
1 281
1 418
2 422
2 453
3 323
3 449
3 882
3 591
3 715thanks
So what is the error?
August 13, 2018 at 9:59 am
joujousagem2006 1602 - Monday, August 13, 2018 9:47 AM
Hello everyone
Who has an idea please about the exact error of the STRING_SPLIT commandCREATE TABLE [dbo].[StagingTable](
[ProductId] [varchar](50) NOT NULL,
[PartsList] [varchar](1000) NOT NULL
)
GOINSERT INTO dbo.StagingTable
(ProductId,PartsList)
VALUES
(1,'463|914|771|281|418'),
(2,'422|453'),
(3,'323|724|449|882|591|715')
select * from StagingTable
cross apply STRING_SPLIT(PartsList,'|')while the requested result is following
1 463
1 914
1 771
1 281
1 418
2 422
2 453
3 323
3 449
3 882
3 591
3 715thanks
Something looks missing, I get 13 rows, the same as the number of elements whilst you are saying that you only get 12 rows?
Can you post the results of SELECT @@VERSION
please?
August 13, 2018 at 10:06 am
I have this result
I am with the sql version 2017
August 13, 2018 at 10:09 am
joujousagem2006 1602 - Monday, August 13, 2018 10:06 AMI have this resultI am with the sql version 2017
What result? I see nothing.
August 13, 2018 at 10:15 am
Thom A - Monday, August 13, 2018 10:10 AMjoujousagem2006 1602 - Monday, August 13, 2018 10:06 AMI have this resultI am with the sql version 2017
What's wrong with that output? I don't see an error there.
it's my fault sorry
after 8 hours of work I lose my concentration
August 13, 2018 at 10:17 am
And now the image is visible.
August 13, 2018 at 10:25 am
joujousagem2006 1602 - Monday, August 13, 2018 10:15 AMit's my fault sorryafter 8 hours of work I lose my concentration
You're doing well. Takes me about 12 minutes.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy