Viewing 15 posts - 646 through 660 (of 2,648 total)
The new STRING_SPLIT with the 3rd operand is great for this. The old STRING_SPLIT without it is not. Even MS has stated that the order of the output is...
December 16, 2022 at 6:20 pm
As a test I used this date range function https://www.sqlservercentral.com/scripts/a-daterange-table-valued-function to insert 6.3M rows into a temporary table to see which is faster. There doesn't seem to be lot...
December 14, 2022 at 1:13 am
Guys... the OP doesn't know which domains contain a "B" ahead of time. He was just explaining the desired results for the test data he provided. Or, at least,...
December 8, 2022 at 1:53 am
Or slightly more concisely
DECLARE @JobDomain int
SET @JobDomain = 1
SELECT *
FROM dbo.TestTable
WHERE JobDomain = @JobDomain
AND (TestType = 'B'
...
December 8, 2022 at 1:40 am
DROP TABLE IF EXISTS #T;
SELECT *
INTO #T
FROM (VALUES ('1A','E'),('1A','IR'),('1A','N'),('1A','SC'),('1A','SCIR'),
...
December 6, 2022 at 5:58 pm
You could insert all the data that needs to be updated into a temporary table with a clustered index on BaseId, also as Scott says make sure the clustered index...
December 6, 2022 at 4:27 pm
SELECT '2500------' AS Field1,
'------' AS Field2,
'------' AS Field3,
...
December 4, 2022 at 12:36 am
SELECT d.*, p.CurrentSizeGB - d.CurrentSizeGB size_diff
FROM [dev_db_size] d
INNER JOIN [prod_db_size] p
ON RIGHT(p.FileName, 3) =...
November 21, 2022 at 11:43 am
Jeffrey Williams wrote:It might be a better option - if using TRY/CATCH - to THROW the error instead of using RAISERROR.
I'd be interested to hear your reasoning.
Using THROW will save...
November 17, 2022 at 5:17 pm
While I'm not an AWS expert by any means when you deploy an RDS instance of SQL it looks to in the backend just put the MDF/NDF/LDF/BAK/TRN all on...
November 14, 2022 at 2:35 pm
The purpose of a data warehouse is to be able to query the data quickly. If you only insert values that have changed with start and end dates, the table...
November 13, 2022 at 10:31 pm
with cte as (select 'PartNbr|#@|Machine|#@|CCode|#@|Cost|#@| ttxx23|#@|plc1|#@| ttxx24|#@|plc2' Value)
,cte2 as (select x.value, x.position from cte
cross...
November 12, 2022 at 1:05 pm
Thanks for spotting that Jeff. I deliberately wrapped an LTRIM around the return value so if a manually written csv sometimes had comma space or just comma it would return...
November 12, 2022 at 1:57 am
If you use this nvarchar(MAX) STRING_SPLIT function
You can do it with the following code:
with cte as (select 'PartNbr|#@|Machine|#@| ttxx23|#@|plc1|#@| ttxx24|#@|plc2' Value)
,cte2 as (select x.value,...
November 11, 2022 at 9:29 pm
I need to add a single quote in each of the alternate characters. The input string could be a variable length.
As an example:
Input String: 5,1,6,1,69,1
output: '5',1,'6',1,'69',1
Input String: 5,1,6,1,3,2,5,3,69,1
output:...
November 2, 2022 at 10:57 pm
Viewing 15 posts - 646 through 660 (of 2,648 total)