Viewing 15 posts - 631 through 645 (of 3,489 total)
FILTER(<tableObject>, ISNONBLANK([Column]) )?
August 27, 2020 at 2:23 pm
(Maybe it made sense to me because I used to work on "databases" where nobody understood normalization... except my databases were small (in terms of records)... there were stupid wide...
August 25, 2020 at 2:56 pm
That's what I assumed it meant. Other interpretations didn't make sense. I suppose writing the table name and column name to at least a temporary table and then using that...
August 25, 2020 at 2:30 pm
I kinda hope there's a better way of doing this... but this works to create a SQL statement containing only the columns with data (in any of the rows)...
August 25, 2020 at 6:03 am
Fill in the missing dates in what table? In the shift table?
This should get you started:
SELECT c.DateKey
FROM dimCalendar c
WHERE NOT EXISTS (SELECT 1
...
August 25, 2020 at 12:09 am
This is somewhat cringeworthy, but since nobody else answered...
use tempdb;
go
-- create a table to store the results:
CREATE TABLE GotData(
RecNo INT IDENTITY,
col1 char(1),
col2 char(1),
col3 char(1),
col4 char(1),
col5 char(1),
col6 char(1)
);
GO
--...
August 24, 2020 at 6:15 pm
You've been here for a while...
Surely you know how to post consumable data.
When I copied and pasted your pictures into SSMS, it wouldn't execute them... so I don't know how...
August 22, 2020 at 6:20 pm
Something like this maybe?
SELECT *
FROM
(SELECT MasterRolls
, MrWgt
, TrimWgt
, rn = ROW_NUMBER() OVER (PARTITION BY MrWgt ORDER BY TrimWgt)
FROM RollSlice) orderedSlice
WHERE orderedSlice.rn = 1;
August 17, 2020 at 5:14 pm
Jeff explains how to post consumable data in this article. Absolutely worth reading. If you read it, and follow the instructions in your next post, someone can write a...
August 14, 2020 at 4:33 pm
Dynamic SQL?
Create one variable to hold the static part of the INSERT statement, and then use the cursor to create the dynamic part, and use sp_executesql to execute the whole...
August 13, 2020 at 6:55 am
So what happens if you create your temporary table and then do something like
INSERT INTO #TempTable(col1)
SELECT * FROM OPENROWSET('MSDASQL','Driver={MySQL ODBC 5.3 ANSI Driver};server=xxxxxxx;userid=xxxxx;pwd=;database=xxxxxx;port=xxxxx;','SELECT col1 from table1')
August 13, 2020 at 4:07 am
use a stored procedure, and create a variable in it, say @Total and ...
SELECT @AllSalesAmount = 1.0 * SUM(Sales[Amount]);
Then divide your sum by that in your pivot.
August 7, 2020 at 9:52 am
Do you mean something like this?
SELECT *
FROM duplicateSample ds2
WHERE ds2.RIN IN (SELECT RIN
FROM duplicateSample ds1
WHERE rowNum = 2 );
August 6, 2020 at 5:27 pm
The most likely reason you're having a hard time is that you're missing a Calendar table. I borrowed some code from Dwain Camps for it. I ran this part...
August 5, 2020 at 4:45 am
Don't get into the habit of using implicit casting. If you're joining on two columns with different data types, one entire column has to be cast, and if you have...
August 5, 2020 at 3:20 am
Viewing 15 posts - 631 through 645 (of 3,489 total)