Tag: sql-server

SQL Server 2016 – ColumnStore and Fetch

Here is my issue, I have a SQL Server 2016 table with around 5,000,000 rows, it has a clustered columnstore index. The following query runs in milliseconds: SELECT * FROM Table Extent1 WHERE ([Extent1].[CustomerIden] = ‘0070db55-6c30-415c-8146-20f43c870107’) AND ([Extent1].[StartTime] <= ‘2015-02-17 08:54:35’) ORDER BY [Extent1].[StartTime] DESC Adding “OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY” to […]

show only max date

I want to get order no 1628481 output showing for 2999-01-01. I am using the Group By command and the aggregate function MAX() for Date and it shows all rows.

How to reduce execution time of stored procedure in SQL Server

I have a stored procedure which selects data from listboxes, spinner input box and checkbox it execute perfectly but it take approximately 2.30 minutes for execution which cause to give me an error in my application. Error is Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not […]

SQL Server spatial STIntersection()

I have two geometries, when i try to get STIntersection from these two geometries, sql server return output of Exception. Msg 6522, Level 16, State 1, Line 6 A .NET Framework error occurred during execution of user-defined routine or aggregate “geometry”: System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component. […]

Casting variables in R Power BI scripts

How I can cast variables in R scripts in Power BI? I get: ggplot2 doesn’t know how to deal with data of class integer I cannot check class of these variables: class(dataset$Transaction) because I get: Error Message: No image was created. The R code did not result in creation of any visuals. Make sure your […]

SQL Server Export To Excel 2010 bigger 255 character

I’m trying to export a SQL server table to an Excel .xlsx file, but when bigger 255 character row, I get an error: Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x00040EDA. An OLE DB record is available. Source: “Microsoft Office Access Database Engine” Hresult: […]

Subtracting rows depending on values of another column

I have two tables purchase, I want to subtract purchase date. depending on Customer ID, there are repeating customer ID’s, so I want to subtract purchase date of Customer ID 105 and 105, 108 and 108 etc. I have the following code, but it is subtracting each purchase date from the next purchase date SELECT […]

Recursive query with CTE – Concatenate all fields of child elements and add to parent

I have to build a WHERE clause for searching employees by formatting a xml which consist of employee details. I have moved the xml data to a temp table and used CTE query to get each node description. I’m facing problem to group the child elements to a parent which has to be done for […]

JDBC availability group connection error

I’m trying to connect to an availability group through sqljdbc driver v4, but I get an error com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host …, port 1433 has failed. Error: “…. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. […]

Using SQL to query a distinct pair based on a similar id

I am running into some trouble finding a way to query a pair, based on similar ids on a table. I have a database schema that consists of something like this: Class: *Course *Size *Class_ID Partner: *Class_ID *Person_ID *Partner_ID Person: *Name *Person_ID *Email When partners are chosen in class, they are given the same partner […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.