Viewing 15 posts - 916 through 930 (of 2,648 total)
Is it possible to exit the proc without falling thru to the DROP TABLE? What about the start of the proc? If the temp table already exists, does the...
March 2, 2021 at 11:13 pm
What about this?:
Update A Set A.[Fname] = B.[Fname]
from [Reporting].[dbo].[D02_CallLog] A
inner join [Reporting].[dbo].[D02_CallLog] B
on A.[CallID] = B.[CallID]
...
March 2, 2021 at 7:50 pm
UPDATE a
SET a.Fname=b.Fname
FROM [dbo].[D2_CallLog] a
CROSS APPLY(SELECT TOP(1) *
...
March 2, 2021 at 7:37 pm
As a guy who constantly advocates for ANSI/ISO standards, I would like to point out that the CONCAT is not SQL but local dialect. The correct syntax is in...
March 2, 2021 at 2:50 pm
IIF is so unlike other other functions and expressions in SQL that it shouldn't be there. That is, nowhere else in SQL does it enclose conditions and the...
March 2, 2021 at 10:01 am
not (invoice_cl in('INN1') and [Payment Status] = 'Unpaid')
= (invoice_cl not in('INN1') or [Payment Status] <> 'Unpaid')
= (invoice_cl <> 'INN1' or [Payment Status] <> 'Unpaid')so the statement
March 2, 2021 at 12:41 am
Have you tried "inner hash join" instead of "join"?
select tm.new_oid, a.aid, a.category, a.attrflag & ~@ATTRFLAG_FROM_TYPICAL_VALUE, a.attrStatusFlag, a.value
from AttribInt as a
inner hash join #tblMerge as...
March 1, 2021 at 4:39 pm
Under the hood SQL Server converts an IIF to a CASE

February 28, 2021 at 7:22 pm
Thanks all for replies.
Jonathan, your solution works. The only downside is that it creates blockings. But this is what was expected.
Ideally you would just have the first column in...
February 26, 2021 at 2:51 pm
begin transaction
select @v1 = max(c1)
from log_test1 with(XLOCK)
set @v2 = @v1 + 1
...
February 24, 2021 at 11:00 pm
select store, SUM(Amount) [Total Purchase],COUNT(distinct a.Cust_ID) [Distinct Customer], z.x [Total Purchase of Distinct Customer]
from Transactions a
cross apply(select sum(Amount) x
...
February 22, 2021 at 8:43 pm
I don't think I understand what you want.
This query is one of the above with an order by added
-- What are the total purchase of those unique...
February 22, 2021 at 8:12 pm
-- What are the total purchases made at each store.
select store,SUM(Amount)
from Transactions
group by store
-- How many unique/distinct customers made purchases at each store.
select store,COUNT(distinct a.Cust_ID)
from Transactions...
February 22, 2021 at 4:09 pm
Hi Jonathan,
This does not give the desired results.
The query you had was the one I originally put in before I edited it a few minutes later. So try this,...
January 31, 2021 at 2:11 am
select count(m.musical_genre_id) as 'Number of Rock Songs', r.artist_name
from song s
inner join album a
on s.album_id...
January 30, 2021 at 8:38 pm
Viewing 15 posts - 916 through 930 (of 2,648 total)