Viewing 15 posts - 2,296 through 2,310 (of 7,608 total)
SELECT CONVERT(varchar(10), I.InvoiceDate, 110) AS InvoiceDate
September 9, 2020 at 8:03 pm
Still there is a shorter version:
select *
from leftTable T1
join rightTable T2
on (
T1.C1 =...
September 9, 2020 at 7:42 pm
You never want to use ISNULL() in a WHERE or JOIN clause. The code may be slightly longer the other way, but it could potentially run much faster.
September 9, 2020 at 7:25 pm
ALTER SCHEMA [dbo] TRANSFER HWData.DesktopSoft_Master;
September 8, 2020 at 3:50 pm
Then your original JOIN is fine and likely the cleanest way to do the join.
September 5, 2020 at 5:34 am
So you want a NULL in the column to match *every* column on the other table that isn't NULL? I.e., NULL is like a wildcard match?
September 4, 2020 at 10:31 pm
I would think you'd want this:
T1 join T2
on ((T1.C1 = T2.C1) OR (T1.C1 IS NULL AND T2.C1 IS NULL))
and ((T1.C2 = T2.C2) OR (T1.C2 IS NULL AND T2.C2 IS NULL))
September 4, 2020 at 8:51 pm
How critical is your application?
You will have an outage between steps 2 and 3 and if the table has foreign key constraints you cannot use truncate table
Don't forget to...
September 3, 2020 at 9:14 pm
As Jeff noted, include TRUNCATE in here.
I did include TRUNCATE in the trans, from the start. Not exactly sure how else you want the transaction structured.
September 3, 2020 at 8:46 pm
I can understand SQL having to scan the table / index, but I don't see why SQL would need to do a sort. Btw, an asc index will do, you...
September 2, 2020 at 7:07 pm
Yes, technically TABLOCKX is only for that statement. I guess in theory someone could INSERT a row between the SELECT and the TRUNCATE.
I should have added HOLDLOCK to the first...
September 2, 2020 at 6:57 pm
I have to admit, in this situation I'd likely just use a cursor and a loop, something like below, just because of the complexity, and likely overhead, of recursion in...
September 2, 2020 at 6:48 pm
Something along these lines:
SELECT TOP (0) *
INTO dbo.maintable_backup
FROM dbo.maintable
--Edit: Added UNION ALL to cancel IDENTITY property, if present
UNION ALL
SELECT TOP (0) *
FROM dbo.maintable
BEGIN TRANSACTION
BEGIN TRY
INSERT INTO dbo.maintable_backup
SELECT...
September 2, 2020 at 3:38 pm
The max list is easy enough to produce. Sorry, I don't fully understand the 'OK' part well enough yet to add that to the query. 'OK' just meaning that you...
September 1, 2020 at 3:38 pm
Viewing 15 posts - 2,296 through 2,310 (of 7,608 total)