Viewing 15 posts - 16 through 30 (of 7,602 total)
A quirky update seems to work, although that requires adding a Calculation column to the original table and making sure the original table is clustered by PricingDate, viz:
CREATE TABLE #Test...
April 9, 2025 at 6:23 pm
I think you might have to read the table again to do what you need to do. Probably best to just do an INNER JOIN, though:
select t2.ID, t2.LINEX, t1.*
from #tmp1...
April 8, 2025 at 2:58 pm
Create a temporary table to load into, with len of 5+, and see if any rows with data longer than 3 bytes are actually getting loaded.
March 27, 2025 at 9:13 pm
Because you used a numeric data type (1) rather than a string. Do this instead:
...
)
SELECT
country_code,order_phone,
case
when country_code IN ('US','CA') and len(order_phone) = 10 then '1' --<<--
when...
March 20, 2025 at 8:00 pm
Add that user to the "model" db -- with whatever permissions you want -- and they will automatically be added to every new db.
March 20, 2025 at 1:50 pm
SELECT TOP (1) reg
FROM ( VALUES(@var1), (@var2) ) AS datetimes(reg)
ORDER BY reg DESC
This approach will be really useful if you ever have to add a 3rd (4th,...
March 19, 2025 at 6:16 pm
DROP TABLE IF EXISTS #view_names;
CREATE TABLE #view_names (
view_name nvarchar(100) PRIMARY KEY
);
INSERT INTO #view_names
VALUES('>--->YOUR_VIEW_NAME_TO_SEARCH_FOR_GOES_HERE<---<')
/*, ('another_view_name_could_go_here') ... */
DROP TABLE IF...
March 17, 2025 at 2:45 pm
Exact code works for me in SQL 2022.
Maybe use bigint rather than int!?:
declare @status as bigint=83457678;
;with nums(num, [2power_Num], bitcheck)
as
(
SELECT Num, POWER(2, CAST(Num AS bigint)), (@status &...
March 13, 2025 at 6:13 pm
It's also possible that you were missing critical index(es) that were forcing full scans of the table. Every issue is not necessarily always exactly the same as one that happened...
March 6, 2025 at 12:22 am
Is there any circumstances where you would allow code with a 'SELECT * ' to go into production?
I believe this should NEVER happen. There is a discussion that...
February 21, 2025 at 8:39 pm
SELECT
LEFT(Bname, CHARINDEX(' ', BName) - 1) AS BName,
MAX(CASE WHEN BName LIKE '% Start%' THEN StartDate ELSE '' END) AS...
February 21, 2025 at 6:02 pm
I don't know of a super-slick way to do this off the top of my head:
SELECT DISTINCT run_date, run_time,
CAST(CAST(run_date AS varchar(8)) +...
February 10, 2025 at 3:32 pm
OOPS, SORRY, I did it back'ards.
SELECT [Profile ID]
FROM dbo.table_name
GROUP BY [Profile ID]
HAVING COUNT(DISTINCT [Customer ID]) =
(SELECT COUNT(DISTINCT [Customer ID]) FROM dbo.table_name)
February 7, 2025 at 7:18 pm
SELECT [Customer ID]
FROM dbo.table_name
GROUP BY [Customer ID]
HAVING COUNT(DISTINCT [Profile ID]) = (SELECT COUNT(DISTINCT [Profile ID]) FROM dbo.table_name)
February 7, 2025 at 3:08 pm
You should definitely switch the key order on the lookup table, i.e., not:
PRIMARY KEY CLUSTERED ( iid, cart_id )
but instead do this:
PRIMARY KEY CLUSTERED ( cart_id, iid )
February 3, 2025 at 5:21 pm
Viewing 15 posts - 16 through 30 (of 7,602 total)