Viewing 15 posts - 1,156 through 1,170 (of 2,645 total)
Answer moved to a different thread
January 30, 2020 at 12:08 pm
I would put the query in a CTE and update the CTE:
;WITH CTE AS
(
SELECT T.col3 col3,
...
January 29, 2020 at 3:42 pm
Your data must be different from the data I provided.
If you want any further help you will have to supply some consumable data.
January 29, 2020 at 2:28 pm
Plucked in your new code. I am still getting the same result.
Which result? This?
Msg 321, Level 15, State 1, Line 88
"ID" is not a recognized table...
January 29, 2020 at 2:18 pm
Jonathan,
You code works for hardcoded values. I replaced the Values with my #Temp1 table. I am getting an error. Any ideas?
SELECT T.Id, T.DocName, T.col1, T.col2,
T.col3 +ISNULL(LEAD(col1) OVER (PARTITION BY...
January 29, 2020 at 1:41 pm
I'm just wondering why you wrote it with an inline-table?
When this would do the same:
SELECT DATEADD(day, 9 - DATEPART(dw, cdata.call_datetime), CAST(cdata.call_datetime AS date)) AS effective_date,
...
January 29, 2020 at 1:18 pm
Hi Jonathan,
Thanks for your input but your code will not work for me. This is because the I have thousand of files that I am importing. Thus hard coded...
January 29, 2020 at 9:33 am
You could try using LEAD
SELECT T.Id, T.DocName, T.col1, T.col2,
T.col3 +ISNULL(LEAD(col1) OVER (PARTITION BY T.DocName ORDER BY T.Id),'') col3
...
January 28, 2020 at 11:58 pm
Can you run the tests on the indexes in a different environment, like UAT or system test?
Can you paste in what indexes are on the table and which ones you...
January 28, 2020 at 8:09 pm
hey,
hold on - wasn't this why hierarchyID types were invented ?
you can even use persisted computed columns to make it nice and fast.
you would need a 1 time hit...
January 28, 2020 at 1:13 pm
It's a good idea from Anthony, you might get even better performance if you also add an index to #TEMP:
IF OBJECT_ID('tempdb..#TEMP') IS NOT NULL
...
January 27, 2020 at 3:47 pm
I think performance might improve if you add an index on SourceId including other columns in the query.
Try this and see if there is an improvement:
CREATE...
January 27, 2020 at 3:20 pm
No need for a cte:
update h
set h.Person = t.Person_To,
h.Pctg = t.Pctg_New
from...
January 24, 2020 at 4:44 pm
No need for a cte:
update h
set h.Person = t.Person_To,
h.Pctg = t.Pctg_New
from #holders h
...
January 24, 2020 at 4:32 pm
Viewing 15 posts - 1,156 through 1,170 (of 2,645 total)