Viewing 15 posts - 781 through 795 (of 2,645 total)
I think this might be what you want:
SELECT pt.[imtPartID],
COUNT(CASE WHEN pt.[imtPartID] = 1 THEN 'x' ELSE NULL END) AS Receipt,
...
November 3, 2021 at 5:38 pm
I can't see that your query will work?
You are missing a bracket after PIVOT.
If you could supply your input data and the output expected it would be easier to understand.
November 3, 2021 at 5:35 pm
CREATE TABLE [dbo].[tblClientService]
(
[ID] [int] IDENTITY(1,1) NOT NULL,
[ClientID] ...
October 30, 2021 at 2:23 am
Thanks Jeff,
Good so see the function is in use. It does make your code much shorter than other methods.
October 27, 2021 at 9:23 am
Data type disparity on join conditions etc is not really an after thought I've seen over time, its more like a 'no thought.' You bring up an excellent point...
October 24, 2021 at 6:46 pm
I think the functions TRY_CAST, TRY_CONVERT and TRY_PARSE might be of use.
October 21, 2021 at 11:26 pm
I think OUTER APPLY is the way to go.
Here is another way to write it, also using OUTER APPLY:
SELECT p.PatID,
...
October 11, 2021 at 11:01 am
This should work
SELECT w2.RCWHS# ...
October 8, 2021 at 2:37 pm
Another method
select *
from #temp t
where t.Branch = 'head quarters'
union all
select *
from #temp t
where not exists(select *
...
October 7, 2021 at 11:00 am
;with cte as
(
select distinct t.Id
from #temp t
)
select t.*
from cte x
cross apply(select top(1) *
...
October 6, 2021 at 12:05 am
I would disagree with the normal way as using DelimitedSplit8K - if the goal is to split out to individual columns, using that utility would require a secondary pivot/cross-tab...
October 4, 2021 at 9:34 pm
It's also the case when you refer to the result of a cross apply multiple times the calculations inside of the cross apply are expanded multiple times.
I...
October 4, 2021 at 4:55 pm
You don't need a table valued function. A view will do the job:
"It Depends". I've found that a whole lot of folks end up writing code that causes...
October 4, 2021 at 3:10 pm
Viewing 15 posts - 781 through 795 (of 2,645 total)