December 4, 2018 at 10:13 am
PSB - Tuesday, December 4, 2018 10:10 AM
What is the compatibility level of the database you are working in?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
December 4, 2018 at 10:14 am
. Set at 110
December 4, 2018 at 10:20 am
PSB - Tuesday, December 4, 2018 10:14 AM. Set at 110
So now you understand the problem, I presume?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
December 4, 2018 at 10:32 am
If I change it to 140, will there be any implications ?
Thanks,
PSB
December 4, 2018 at 10:36 am
PSB - Tuesday, December 4, 2018 10:32 AMIf I change it to 140, will there be any implications ?Thanks,
PSB
Of course. It will be treated as a 2017 database rather than a 2012 database. The new cardinality estimator will kick in. New features and functions will be available to you. Do not do this on a production system you care about until you have performed testing.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
December 4, 2018 at 10:38 am
All right, I have changed the compatibility level to 140 for my database .
I have different Line items for Country column
Astrakhan, Azerbaijan, Kazakhstan, Russia Land, Sakhalin, Uzbekistan, Turkmenistan
Astrakhan, Sakhalin
Azerbaijan, Kazakhstan, Turkmenistan, Uzbekistan
With this code:
;WITH Split (Value)
AS
(
SELECT DISTINCT Country
FROM [dbo].[Table] YT CROSS APPLY STRING_SPLIT(REPLACE([Country], ' ', ''), ',') ss
)
SELECT STRING_AGG(Split.Value, ', ') WITHIN GROUP (ORDER BY Split.Value)
FROM Split;
I get all values in one row :
Astrakhan, Azerbaijan, Kazakhstan, Russia Land, Sakhalin, Turkmenistan, Uzbekistan, Astrakhan, Sakhalin, Azerbaijan, Kazakhstan, Turkmenistan, Uzbekistan, Argentina, Bolivia, Argentina, Bolivia, Brazil, Chile, Astrakhan, Azerbaijan, Kazakhstan, Russia Land, Sakhalin, Turkmenistan, Uzbekistan, Azerbaijan, Brazil, California, Canada Land, Houston, Midcontinent, Northeast, Rockies, South Texas, Southeast, West Texas, Colombia, Ecuador, Colombia, Peru, Ecuador, Kazakhstan, Kazakhstan, Uzbekistan , LAN HQ, LAS HQ, Sakhalin, Turkmenistan
Thanks,
PSB
December 4, 2018 at 11:08 am
PSB - Tuesday, December 4, 2018 10:38 AMAll right, I have changed the compatibility level to 140 for my database .I have different Line items for Country column
Astrakhan, Azerbaijan, Kazakhstan, Russia Land, Sakhalin, Uzbekistan, Turkmenistan
Astrakhan, Sakhalin
Azerbaijan, Kazakhstan, Turkmenistan, UzbekistanWith this code:
;WITH Split (Value)
AS
(
SELECT DISTINCT Country
FROM [dbo].[Table] YT CROSS APPLY STRING_SPLIT(REPLACE([Country], ' ', ''), ',') ss
)
SELECT STRING_AGG(Split.Value, ', ') WITHIN GROUP (ORDER BY Split.Value)
FROM Split;
I get all values in one row :
Astrakhan, Azerbaijan, Kazakhstan, Russia Land, Sakhalin, Turkmenistan, Uzbekistan, Astrakhan, Sakhalin, Azerbaijan, Kazakhstan, Turkmenistan, Uzbekistan, Argentina, Bolivia, Argentina, Bolivia, Brazil, Chile, Astrakhan, Azerbaijan, Kazakhstan, Russia Land, Sakhalin, Turkmenistan, Uzbekistan, Azerbaijan, Brazil, California, Canada Land, Houston, Midcontinent, Northeast, Rockies, South Texas, Southeast, West Texas, Colombia, Ecuador, Colombia, Peru, Ecuador, Kazakhstan, Kazakhstan, Uzbekistan , LAN HQ, LAS HQ, Sakhalin, TurkmenistanThanks,
PSB
Try changing SELECT DISTINCT Country to SELECT value
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 8 posts - 16 through 22 (of 22 total)
You must be logged in to reply to this topic. Login to reply