sql-server-2017

How does one structure queries to amalgamate master detail records over a given period

☆樱花仙子☆ 提交于 2019-12-13 04:02:30
问题 Consider the following scenario (if it helps think Northwind Orders / OrderDetails). I have two tables LandingHeaders and LandingDetails, that record details about commercial fishing trips. Typically, over the course of a week, a fishing vessel can make several trips to sea, and so will end up with several LandingHeader/LandingDetail records. At the end of each week the company that purchases the results of these fishing trips need to work out the value of each landing made by each vessel and

Remove element from JSON array for whole table

 ̄綄美尐妖づ 提交于 2019-12-13 03:37:08
问题 I have a column filled with JSON arrays. It looks like: Numbers '[1,33,5,4,5]' '[1,2,555,4,5]' '[1,5,3,4,5]' '[1,25,3,4,5]' '[1,2,5,4,5]' '[1,2,3,4,55]' I want to remove all instances of 5 (not 55, 555 or 25) so it looks like Numbers '[1,33,4]' '[1,2,555,4]' '[1,5,3,4]' '[1,25,3,4]' '[1,2,4]' '[1,2,3,4,55]' I have Full Text Indexing so I can identtify the rows that contain it using CONTAINS(Numbers, '5') Does anyone know a quick/clean way to remove all the 5's? I know I could use multiple

How to concatenate rows into one cell and add break line after each one using SQL Server

回眸只為那壹抹淺笑 提交于 2019-12-13 02:27:19
问题 I am using SQL Server 2017 and I am trying to create a query that concatenates the languages and Levels of Proficiency in one line for every Employee. The table that stores the info in my SQL Database is this for example: And the end result I would like to achieve is this: Using Stuff function and xml path I have managed to create a select query that shows this: But I can't find a way to insert a break line. The query will be used as a datasource for an AspxGridview. Any help? Thank you in

“Oops” error while installing SQL Server 2017 developer edition on Windows 10

主宰稳场 提交于 2019-12-12 10:48:18
问题 I'm trying to install SQL Server 2017 Developer edition with "Basic" installation type but it gives below error message: Oops... Unable to install SQL Server (setup.exe). Build version it is trying to install is 14.1710.3866.2 I've already tried running the installer several time but I got the very same error screen every time. Also tried launching the installer with administrative privileges but no luck. Does anyone has any idea about this mysterious error message and how to overcome it? It

Using revoscalepy to insert data into a database

五迷三道 提交于 2019-12-11 18:24:11
问题 Ahoi there, is there a possibility of using the revoscalepy package to insert values into a table? I would expect something along the lines of: import pandas as pd from revoscalepy import rx_write_to_db, RxOdbcData a_df = pd.DataFrame([[0, 1], [2, 3]], columns=[...]) rx_write_to_db(RxOdbcData(connection_string=con_str, ...), data=a_df) But I couldn't find anything like this. The closest option appears to be rx_write_object, which dumps the dataframe as a binary into the table. More

Importing pyodbc results as Internal server error in Apache HTTP Server

≡放荡痞女 提交于 2019-12-11 14:06:41
问题 Executing the cmd as c:\>pip install pyodbc " pyodbc.cp36-win32.pyd " file will be created Collecting pyodbc Using cached pyodbc-4.0.21-cp36-cp36m-win32.whl Installing collected packages: pyodbc Successfully installed pyodbc-4.0.21 When I try to run in Apache24 Server the below code results in Internal Server Error import pyodbc cnxn = pyodbc.connect("Driver={ODBC Driver 13 for SQL Server};" "Server=DESKTOP;" "Database=demo2017;" "Trusted_Connection=yes;") cursor = cnxn.cursor() cursor

Pulling Values From Temp Table After An Iteration

做~自己de王妃 提交于 2019-12-11 10:53:00
问题 I'm querying for the total sizes of recent data in certain databases. I create a table containing the DBs to be queried then iterate over it to get the DB names and total number of times to run the iteration. I then create a temptable where the needed data will be inserted into. I run the iteration to grab the information and push it into the temptable for each database. After the iteration finishes I'm not able to pull the values from this newly created table. I wrote a little comment next

Treating a tab-delimted column as a bulk insert in SSIS

删除回忆录丶 提交于 2019-12-11 08:08:23
问题 I am importing a flat file with the following format: H(tab)OrderNumber(tab)CustomerNumber(tab)ERPMessage D(tab)OrderNumber(tab)ItemNumber(tab)ItemDescription(tab)ItemPrice(tab)Qty D(tab)OrderNumber(tab)ItemNumber(tab)ItemDescription(tab)ItemPrice(tab)Qty . . . I am BULK LOADing the file using a format file to a staging table that looks like this: RecordType varchar(1) RecordDetail varchar(MAX) so when it hits my staging table, it looks like this: RecordType | RecordDetail -------------------

Use views and table valued functions as node or edge tables in match clauses

淺唱寂寞╮ 提交于 2019-12-11 06:24:39
问题 I like to use Table Valued functions in MATCH clauses in the same way as is possible with Node tables. Is there a way to achieve this? The need for table valued functions There can be various use cases for using table valued functions or views as Node tables. For instance mine is the following. I have Node tables that contain NVarChar(max) fields that I would like to search for literal text. I need only equality searching and no full text searching, so I opted for using a index on the hash

Cannot connect UWP app. to SQL Server 2017 instance:

北慕城南 提交于 2019-12-11 05:45:43
问题 UWP app. returns A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 25 - Connection string is not valid)" Trying to connect to a SQL Server 2017 instance. This is all on a local dev. machine, Windows 10 (no remote). Have followed advice in SO to no avail: