Viewing 15 posts - 241 through 255 (of 7,608 total)
You can't use declared RI, but you could write your own.
As to the design, I assume the EntityIDs of the various tables -- Person, Service, Organisation, etc. -- overlap. That's...
February 20, 2024 at 2:56 pm
I think my code would adjust as follows to check program_date for inclusion:
SELECT ca1.*
FROM dbo.cust_sales_temp cst
CROSS APPLY ...
FROM (
SELECT month#, sales, ROW_NUMBER() OVER(ORDER...
February 16, 2024 at 8:12 pm
SELECT ca1.*
FROM dbo.cust_sales_temp cst
CROSS APPLY (
SELECT cst.customer_id, cst.program_date,
MAX(CASE WHEN row_num = 1 THEN sales...
February 16, 2024 at 7:03 pm
Recursion is notoriously slow for iteration. Maybe use a "standard" tally table instead:
;WITH
cte_tally10 AS (
SELECT * FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) AS numbers(number)
),
cte_tally100 AS (
...
February 16, 2024 at 2:41 pm
CREATE VIEW must be in a batch by itself, i.e., without GOs, you could create only one view per script.
Since GOs are likely not valid, that may be what you...
February 14, 2024 at 7:22 pm
In this case it doesn't. But what is the harm in CASTing?
February 13, 2024 at 10:47 pm
The first three rows in the table DO all match the first "<" condition: 00:05:xx and 00:10:xx are less than 00:15:xx. Only the second condition limits the result to a...
February 13, 2024 at 7:53 pm
For example, when the lengths are consistent, it seems to produce the desired result:
DROP TABLE IF EXISTS #xr;
CREATE TABLE #xr ( length_min varchar(8) NOT NULL, length_max varchar(8)...
February 13, 2024 at 7:49 pm
It seems like this is a character comparison. If so, "00:15:18" would not compare correct "0:...", since you have two leading zeros vs one leading zero. If you're going to...
February 13, 2024 at 7:45 pm
Don't change the CASTing for the bits in the WHERE clause, leave as is. Otherwise I believe SQL will default to a different data type which would force a column...
February 13, 2024 at 7:37 pm
I generated SQL separately for each view, even though that requires a cursor. In this specific case, I think you may want to be able to control things table by...
February 12, 2024 at 3:13 pm
Somehow you left out the "SET @MyBit = 0" on one function?
February 9, 2024 at 9:17 pm
Except stay completely away from INFORMATION_SCHEMA views, which are more overhead anyway. Use sys.tables, sys.columns, etc., instead.
February 9, 2024 at 7:55 pm
And what would you want to name the view?
February 9, 2024 at 6:23 pm
Sample data and results are almost always clearer than just a textual explanation. I hope this matches what you need:
SELECT
ISNULL(t2.CarColor, t1.CarColor) AS CarColor,
...
February 8, 2024 at 7:31 pm
Viewing 15 posts - 241 through 255 (of 7,608 total)