Viewing 15 posts - 736 through 750 (of 3,489 total)
Be brave. try it. LAG() looks at the previous record in a window (defined by the PARTITION clause) and LEAD() looks at the "next" record.
April 10, 2020 at 10:58 pm
Use a numeric index on the possible values and then use NEW_ID() to generate a random number?
April 6, 2020 at 5:19 pm
Huh? This HTML is messed up. Standard format for an HTML table is
<table>
<tr>
<td>R1C1</td>
<td>R1C2</td>
<td>R1C3</td>
</tr>
<tr>
<td>R2C1</td>
...
April 4, 2020 at 1:15 am
"Pfffft! *he* wrote it??? Not reading that!!"
LOL
April 4, 2020 at 12:55 am
If a driver can NEVER drive more than one car, and you don't care about the car if it doesn't belong to that driver, then you could incorporate the Car...
April 3, 2020 at 8:35 pm
"[Drivers] can technically "own" more than one vehicle personally, but they only drive one for our company really."
I would probably have one table for Drivers and one for Vehicles, and...
April 3, 2020 at 6:42 pm
wait... this design is off.
Taking a step back... Can you explain the relationship between Person and Vehicle? Can one person own more than one vehicle? Can one vehicle be owned...
April 3, 2020 at 5:53 pm
I totally missed that full outer join. =(
April 3, 2020 at 7:16 am
So you mean you're trying to UNION the two split results? Like this? the short version of union is
SELECT f1, f2, f3
FROM t1
UNION ALL
SELECT f4,f5,f6
FROM t2;
So your...
April 3, 2020 at 6:33 am
Use a better splitter function? I used Jeff Moden's DelimitedSplit8K which is here ...
Setup (this is the part you were supposed to do):
use tempdb;
go
CREATE TABLE #BadData...
April 3, 2020 at 2:19 am
are you querying the master or querying a replica?
April 3, 2020 at 12:20 am
Ouch... had to reformat all that so it was easier to read...
IF OBJECT_ID('product') IS NOT NULL
DROP TABLE [dbo].[product]
CREATE TABLE [dbo].[product](
[productid] [VARCHAR](20) NULL,
[productEventID] [VARCHAR](50) NULL,
[productTransID] [VARCHAR](50) NULL,
[productEffectiveDate] [DATETIME]... April 2, 2020 at 4:33 pm
Post the definition of your Calendar table. Are you familiar with dimension tables in data warehouse designs? Normally a Calendar dimension will be something like this:
CREATE TABLE...
April 2, 2020 at 2:47 am
Re-reading this... are you trying to do a running total, or just a normal total? If you want a running total, I'd use a windowing function.
SUM([numeric column]) OVER (PARTITION BY...
April 1, 2020 at 7:16 pm
WITH (nolock) isn't a magic "go faster" button. It's allowing dirty reads. If you want it to read faster, index the columns in the joins and the filters.
We don't even...
April 1, 2020 at 4:09 am
Viewing 15 posts - 736 through 750 (of 3,489 total)