Viewing 15 posts - 1 through 15 (of 7,610 total)
> 3 columns (2 int and 1 bigint) <
This could be a (rare) case where partitioning is a good idea; partitioning being based on one/both of the 2 int leading...
January 28, 2026 at 12:19 am
Actually, none of the suggested code, since you should always specify NULL or NOT NULL when ADDing columns to be sure you get the specific setting you want.
January 21, 2026 at 7:22 pm
You can also do it with a single result set. Which performs better would depend, so you'd have to test that out.
This method would also be much easier if you...
December 10, 2025 at 9:10 pm
Great, glad it helped. Many thanks for the feedback.
December 10, 2025 at 9:04 pm
I'm not sure PIVOT can give you the results you want.
Maybe try this instead?:
SELECT
COALESCE(BBBB.STOCK_CODE, CCCC.STOCK_CODE) AS STOCK_CODE,
COALESCE(BBBB.MNEMONIC, CCCC.MNEMONIC)...
December 10, 2025 at 7:58 pm
D'OH, obviously there is an mbi column, since it's directly referenced in the query.
The point here is that, in a subquery, if you reference a column that exists in a...
December 9, 2025 at 4:15 pm
Is there an MBI column in table "edi.dbo.PEC_RGT_EDI_834_Inbound_Exception"?
If so, the second query works because it is comparing xx.MBI to itself, which will always be equal (unless MBI is NULL, oc).
x.MBI...
December 9, 2025 at 2:44 pm
My thoughts on this:
(1) Decide whether you want to include nvarchar or not.
(2) Gen a list of the tables to be changed: then, if you need to, you can custom...
December 1, 2025 at 8:57 pm
I identified the changes I made to the original code using /*--<<--*/ on/around them. This code should also perform better.
SELECT
sa.partid AS ALLOC_Part,
sa.quantity,
sa.ordertype,
sa.worksorderid,
sa.reference,
sa.stockvalue,
apm.partdesc,
soi.orderid,
soi.itemnumber,
soi.partid AS SOI_Part,
so.traderid,
t.name,
u.name As SalesRep,
sub.Max_Batchvalue AS...
November 24, 2025 at 4:55 pm
You could also use Brian Gale's approach and use a proc to generate all the code for you. Personally I would stick with dynamic SQL, but the other is an...
November 17, 2025 at 9:38 pm
Columnstore won't gain you much (other than perhaps some disk space) since you are reading all the columns. Personally, I would just use page compression.
November 12, 2025 at 9:58 pm
Absolutely agree with analyzing page compression for the table. It could be a huge help. You can use:
EXEC sys.sp_estimate_data_compression_savings 'dbo', 'table_name', NULL, NULL, 'PAGE'
As you noted, the nonclus index is...
November 12, 2025 at 6:31 pm
I thought it was more complicated than that because a CHAR(13) should also count as a "space" as far as splitting words?! Perhaps not, I guess it depends on exactly...
November 6, 2025 at 7:38 pm
IF UPDATE(CreditLimit)
That approach seems preferable to me, unless you really have to use COLUMNS_UPDATED()
August 13, 2025 at 2:07 pm
If the quirky UPDATE works, can you modify the original table to include the new calculated column?
Let me ask: once a value has been calc'd, would it ever change? In...
May 12, 2025 at 6:12 pm
Viewing 15 posts - 1 through 15 (of 7,610 total)