sql-server-2017

Replace cursors with queries

巧了我就是萌 提交于 2019-12-11 05:17:18
问题 Let's say I have a booking covering 6 hours and 3 discounts covering 2 hours each. I want to split my booking into 3 parts so I can allocate 2 hours per discount. It would return something like this: BookingId 1 | DiscountId 1 | Qty 2 BookingId 1 | DiscountId 2 | Qty 2 BookingId 1 | DiscountId 3 | Qty 2 I would then insert those records this into another table. I'm using an heavily optimized query to determine the number of hours available for each discount. However, I can't find a "good" way

Syntax to query for optional relationships in Microsoft SQL Server 2017 Graph Database?

冷暖自知 提交于 2019-12-11 02:02:48
问题 I want to select optional relationships in sql-server-2017-graph. Similar to optional in sparql e.g.: PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox ?mbox } } from https://www.w3.org/2001/sw/DataAccess/rq23/#OptionalMatching. And similar to LEFT JOIN in normal sql; e.g.: SELECT name, mbox FROM Persons LEFT JOIN PersonMailBoxLink ON Persons.$node_id = PersonMailBoxLink.$from_id LEFT JOIN MailBoxes ON PersonMailBoxLink.$to_id =

BULK INSERT into a Self-Referencing Table

六月ゝ 毕业季﹏ 提交于 2019-12-10 19:29:15
问题 This question is part of a much more complex problem that I am breaking down into smaller chunks (for my sanity). Let's say I have a Parts table that is self-referencing and looks something like this: PartId ParentPartId Description PartNumber IsCatHeader ProviderId --------------------------------------------------------------------------------------- 9292 null 'Engine Parts' null 1 'Engine Parts||1' 9293 9292 'Engine Bolts' null 1 'Engine Bolts||1' 9294 9293 '6mm Engine Bolt' 'X1-234-ABC' 0

Flat file connection manager carriage return/line feed discrepancy

廉价感情. 提交于 2019-12-10 15:38:29
问题 I'm upgrading from SQL Server 2008R2 to 2017, and making the same jump with SSIS. There are a number of flat file imports that are picking up files that have carriage return/line feeds ( {CR}{LF} ) embedded within a column in the row. The 2008R2 flat file connection manager ignores the embedded {CR}{LF} s that are within a row, but the flat file connection manager in 2017 is treating each {CR}{LF} as a new line. It's the same in an upgraded connection manager or a brand new one that I make

Fill in gaps in data, using a value proportional to the gap distance to data from the surrounding rows?

喜你入骨 提交于 2019-12-10 13:33:26
问题 At some point soon I'll have to prepare a list of prices of items on days. The granularity is 1 day and on days when there are sales of an item, I'll average the prices to get that day's average. There will be days where no sales are made, and I'm suited that an adequate approximation can be used by pulling the previous and next occurrences of sales, and for each day between them having a price that transitions linearly from one to the other. Imagine the raw data is: Item Date Price Bread

Error when installing SSDT (SQL Server Data Tools)

落花浮王杯 提交于 2019-12-10 02:09:39
问题 I have a problem during the installation of SQL Server Data Tools for Visual Studio 2017 I get the following error (translated): The requested meta file operation is not supported (0x800707D3) Screenshot: See here Log file available here: https://www.dropbox.com/s/e34kry9ycj76j7n/SSDT-Setup-ENU_20171219090643.log?dl=0 Here's the relevant section from the linked log file: [13C4:3020][2017-12-19T10:07:22]i000: MainViewModel.OnPackageActionProgress: Percent completed: 0, Overall progress: 27

ASP.NET core background service to send data through signalR

核能气质少年 提交于 2019-12-08 05:46:10
问题 I'm using signalR to send data to clients from server. What I want to is check data in the table(MSSQL DB) and send the related data to clients through signalR. So I want to create some background service to check database and send data. I planned to use System.Threading.Thread.Sleep(3000); with while(true) loop. How can I create service class to run this method in startup. Is there any method to use do this task in standard way?? 回答1: You can use an IHostedService and IHubContext to

Oracle JRE rule failure while installing SQL Server 2017 Developer edition

你说的曾经没有我的故事 提交于 2019-12-06 04:54:58
问题 I'm unable to pass below rule while installing SQL Server 2017 Developer edition on windows 10 machine on Feature Rules screen: Oracle JRE 7 Update 51 (64-bit) or higher is required for Polybase I'm getting below error: This computer does not have the Oracle Java SE Runtime Environment Version 7 Update 51 (64-bit) or higher installed. The Oracle Java SE Runtime Environment is software provided by a third party. Microsoft grants you no rights for such third-party software. You are responsible

Error when installing SSDT (SQL Server Data Tools)

久未见 提交于 2019-12-05 01:06:26
I have a problem during the installation of SQL Server Data Tools for Visual Studio 2017 I get the following error (translated): The requested meta file operation is not supported (0x800707D3) Screenshot: See here Log file available here: https://www.dropbox.com/s/e34kry9ycj76j7n/SSDT-Setup-ENU_20171219090643.log?dl=0 Here's the relevant section from the linked log file: [13C4:3020][2017-12-19T10:07:22]i000: MainViewModel.OnPackageActionProgress: Percent completed: 0, Overall progress: 27 [13C4:3020][2017-12-19T10:07:22]i000: MainViewModel.OnPackageActionProgress: Percent completed: 0, Overall

Oracle JRE rule failure while installing SQL Server 2017 Developer edition

旧时模样 提交于 2019-12-04 11:13:21
I'm unable to pass below rule while installing SQL Server 2017 Developer edition on windows 10 machine on Feature Rules screen: Oracle JRE 7 Update 51 (64-bit) or higher is required for Polybase I'm getting below error: This computer does not have the Oracle Java SE Runtime Environment Version 7 Update 51 (64-bit) or higher installed. The Oracle Java SE Runtime Environment is software provided by a third party. Microsoft grants you no rights for such third-party software. You are responsible for and must separately locate, read and accept applicable third-party license terms. To continue,