|
|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Limiting the Data Frame | |
I've got this data frame in R:
> travel Passenger FlightDate Destination Miles Dollars 1 Steve 20180225 LHR 11789 1100 2 Steve 20180512 LHR 10989 1500 3 Steve 20180620 LHR 11789 1800 4 Steve 20180830 LHR 11789 1100 5 Steve 20181015 LHR 9678 2700 6 Steve 20181212 LHR 10520 1500 7 Steve 20180810 MSY 2427 440 8 Steve 20180225 OSL 1502 210 9 Steve 20180225 DCA 1475 310I want to extract out the flights to London (LHR) that were more than 10,000 miles. I try this: > london.flights = subset(travel, Destination = "LHR" & Miles > 10000)However, this doesn't work. I still see all my flights. What should I run? | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by Steve Jones - SSC Editor) |
Computed Column Indexes I have this definition for a computed column in my table: ALTER TABLE dbo.Activities ADD ProdOneCount AS CASE WHEN ProductID = 1 THEN CallCount ELSE 0 END; I now want to run this code. What happens when I run this? CREATE INDEX dbo.Activities_PRodOneCountThreshold ON dbo.Activities (ProdOneCount) WHERE CallCount > 50; GO Answer: The index is created Explanation: This works fine. There is no issue with adding a regular non clustered indexing on a computed column. Ref: Indexes on computed columns - https://docs.microsoft.com/en-us/sql/relational-databases/indexes/indexes-on-computed-columns?view=sql-server-2017 |
Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Administration |
SSMA tool shortcomings ? - I prefer to use ssma tool to perform the database migrations from older versions of SQL server to newer versions but could see the tool has a few shortcomings like it deletes the backup files after restoring , it wont change the database owner , compatibility level of the restored databases , it wont fix […] |
SQL Server 2017 - Development |
Round at specific decimal point - Hi, I am trying to round my numbers up to the nearest whole number if the decimal is equal to or greater than .7, for example 28.7 will be 29, or round down if it is below .7, for example, 28.6 will be 28. I'm not sure If I need to truncate first and make […] |
STIntersect - A friend of mine asked me a really interesting question, and I'm a little stumped. She's trying to determine from a given flight plan, which countries a plane will fly over. I was thinking the flight plan could be described as a linestring of (long, lat) points and then I could use STIntersect to see […] |
SQL Server 2016 - Administration |
SQL Copy Database Wizard Broken - I have been using the SQL Copy Database Wizard (right click on the DB and Copy Database option) through the GUI (SMS) to copy a DB up until SQL 2016. Every installation I have where 2016 or greater has been involved the feature is broken and always gives the same error. It doesn't matter if […] |
SQL Server 2016 - Development and T-SQL |
Transaction handling in sql server - Hi All, Have some questions related to transaction management in sql server. 1. What is the difference between having SET XACT_ABORT is ON and having BEGIN TRY ... CATCH ROLLBACK; 2. What if I use only BEGIN TRY ... CATCH ROLLBACK; and do not use XACT_ABORT ON ? Any issues we need to keep in […] |
how to merge 3 different temp tables data into one - Is there any better way to do this? create table #student (StudentName varchar(20) null, StdId int not null, Stdgrade varchar(10) null) insert into #student (StudentName , StdId , Stdgrade ) select std.Name ,std.StdID ,dp.stdgrade from dbo.student std join dbo.department dp on std.stdid = dp.id where dp.isactive = 1 insert into #student (StudentName , StdId […] |
SQL Server 2012 - T-SQL |
Need help to calculate in Single Query - My table and data as follow, USE [WeightManagement] GO /****** Object: Table [dbo].[crpt_NotaPenyataKewangan_BL_Vertical_1] Script Date: 7/11/2019 10:41:39 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[crpt_NotaPenyataKewangan_BL_Vertical_1]( [idx] [int] IDENTITY(-2147483648,1) NOT NULL, [batch_Id] [uniqueidentifier] NULL, [group_1Digit] [char](5) NULL, [group_2Digit] [char](5) NULL, [group_3Digit] [char](5) NULL, [chart_code] [char](5) NULL, [pusat_kos] […] |
Find records from the last 24 hours - How do I get the records for the last 24 hours for each VisitID, based on the ActivityDateTime? So, beginning at the most recent ActivityDateTime for each VisitID, go back 24 hours and pull those records. create table #T1 ( VisitID varchar(30), IdentifierID varchar(30), ActivityDateTime datetime ) insert into #T1(VisitID,IdentifierID,ActivityDateTime) values('F0-B20191023162046527','20907277','2019-10-24 10:18:00.000') insert […] |
Get some row depending of Date of nexts rows - Hi, Sorry for my bad english. I need to select some rows of a table like that : Id Object | Start | End A | 06/11/2019 09:00 | 06/11/2019 09:15 A […] |
SQL Server 2008 - General |
sp_executesql not working - Hi, We have 2 dbs DB A and DB B on two servers AA and BB respectively linked to each other. Stored Procedure(stp) Stp_A in DB A calls stp_B in DB B fetches data from DB A and stores it in temperory table. we have used dynamic sql and used exec sp_executesql command. the sample […] |
SQL Azure - Administration |
Migrate Database with column level encryption to Azure - Hi, We've got an on-premise database that uses column level encryption and are currently investigating whether we could migrate it to the SQL Database service in Azure. In the past if we have moved the database between on-premise servers we've been able to change the master key to encrypt by password before taking a backup […] |
Reporting Services |
Hosting PowerBI in SSRS - Overview I have been tasked with the question is there a tool that can host PowerBI reports other than PowerBi Reports Engine? The problem I believe is licensing. We have license for SQL Server Enterprise 2017 that includes SSRS & SSAS. Question Can we host PowerBI Reports in SSRS? I believe I got the answer […] |
Reporting Services 2008 Development |
How to make Time Range chart in SRRS? - Hi Everyone, I am new to in SSRS report development, I have a requirement like to show the report in SSRS as below formant, Could you please help me to achieve this result? How should keep data in SQL script every five minutes what is machine status? |
TFS/Data Dude/DBPro |
TFS change tracking and details. - Hi, I had a quick question and I am using TFS 2015. How do I see what is the changeset number of an SP which is deployed just now? How do I find out at what time that Stored procedure or object was checked in? Thanks! |
Integration Services |
Dataflow each batch takes longer - I'm looking for a technical reference on how fast-load work. Each buffer transfer seems to take longer Case: Transfer data from Oracle to SQL Server Dataflow Source: Oracle Oledb, fetchsize 50000, default buffer max rows 50000 Dataflow Destination: SQL Server (fast-load), rows per batch 50000, maximum commit size 50000 The transfers start quick, but as […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |