Viewing 15 posts - 406 through 420 (of 3,500 total)
Oh, you've GOT to be kidding. I'm not downloading that. Post your CREATE TABLE statements, and maybe a handful of INSERTs for each table to show the relationship. Foreign keys...
February 8, 2022 at 8:28 pm
What I want to do is to exit the while loop after it finds the top record for each tank.
How would one determine that programmatically? TOP doesn't mean anything without...
February 5, 2022 at 4:03 am
Different how? Different filters? different columns?
IF @Selection = 1
BEGIN
SELECT...
END
IF @Selection = 2
BEGIN
<other> SELECT...
END
Different filters would be a whole lot easier. Maybe use COALESCE() to ignore some empty parameter values and...
February 3, 2022 at 8:44 pm
Why not put all the views you want to expose in a single schema, and then just grant rights to the schema?
February 2, 2022 at 5:25 pm
Sorry for the roundabout answer, but I'd check with Chrissy LeMaire and Rob Sewell, because they literally wrote a book about manipulating SQL Server objects with PowerShell.
January 30, 2022 at 3:41 am
I don't think you can use the * wildcard with UNION or UNION ALL. You need to explicitly list the columns.
January 28, 2022 at 3:32 am
You don't really need to store the duration at all. Well, unless you really want to for some reason. (I guess it's okay, because once a duration is calculated, it's...
January 26, 2022 at 3:18 pm
Ouch! Not exactly a rookie question! Since you're brand new, I created a simple table...
use tempdb;
go
CREATE TABLE deviceActivity (
deviceID int not null,
EventName CHAR(3) not null,
EventTime datetime not...
January 25, 2022 at 9:52 pm
Some consumable data (CREATE TABLE and INSERT scripts) would be really nice.
If the On/Off events are in pairs (so you can't two "On" events in a row for the same...
January 25, 2022 at 9:11 pm
How are you using your data warehouse data? If you're using PowerBI or Excel, there's a USERELATIONSHIP() function, where you can have multiple relationships between two tables (like Sales fact...
January 24, 2022 at 2:54 pm
For example? maybe check out Jeff Moden's article on Crosstabs
January 21, 2022 at 2:44 pm
Your case statement is a bit off... try this:
use tempdb;
go
CREATE TABLE tibbleTransactions(TransactionID INT IDENTITY, TransactionDescription VARCHAR(10), Amount INT);
GO
INSERT INTO tibbleTransactions(TransactionDescription, Amount) VALUES ('Positive',10),('Negative',20),('Positive',20);
SELECT TransactionID, TransactionDescription, Amount
FROM tibbleTransactions;
SELECT...
January 21, 2022 at 4:38 am
Use a running aggregate before you pivot?
SELECT n
, rt = SUM(t.n) OVER (order by n rows between unbounded preceding and current row)
FROM Testdb.dbo.tally t;
tally is just a...
January 19, 2022 at 10:47 pm
Understanding what the different tables describe helps a lot. You don't necessarily have to understand the entire diagram, just the part(s) you're going to use.
January 16, 2022 at 4:18 pm
Viewing 15 posts - 406 through 420 (of 3,500 total)