I have a series of records. Based on the data below, how to get all transaction (XZ) for specific customer invoice (XR)? Legend Example 1 Condition Desired output Explanation above: There is Customer invoice (XR) with the amount of 36,247.62. There is payment recorded (XZ) with the value of 4.76 for document …
Tag: sql-server
Incorrect syntax near format in BULK INSERT?
I’m trying to figure out why the BULK INSERT command I’m using isn’t recognizing the FORMAT and FIELDQUOTE options used in the command. For some reason, I’m getting the error: Msg 102, Level 15, State 1, Line 6 Incorrect syntax near ‘FORMAT’. Addition: FORMAT shows up in pi…
Connecting to the Tabular Instance of an Azure-hosted SQL Server Analysis Services Server
I have set up an Azure Virtual Machine with a SQL Server 2016 Standard Edition image. I have installed an instance of Analysis Services Tabular on the machine and configured endpoints such that I can access it from my local machine. I have deployed SQL Server, SSAS Multidimensional, and SSAS Tabular databases…
How to find these master records whose totals are not accurate
I have two tables (master-details relationship). The master table has a column (called total) recording the number of details records for the same master record. Having this column is for the performance reason). Here are the table specs: Because deletion of details records, the total in the master table may …
Using ‘LIKE’ and ‘REGEXP’ in a SQL query
I’m trying to use some regex on an expression where I have two conditions on the WHERE clause. The pattern I want to capture is 106 followed by any digit followed by a digit that must be either 3 or 4, i.e. 106[0-9][3-4] First, I tried this: This produced an error as below and it would be good to know
SAS pass through query to SQL Server
I have some troubles with passing through query to SQL Server. OS is RedHat 6. In SAS Enterprise Guide I try to execute this code: but I faced with error: ERROR: CLI execute error: [SAS][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]INSERT failed because the following SET options have incorrect s…
SQL Server Select query with IN() and order by the same
I need a SELECT query with an IN clause, as well as Order by: select * from table where column_id IN (5,64,2,8,7,1) This code returns 1, 2, 5, 7, 8, 64. Now I need to return the same select in …
Update statement SQL with CTE
I have a common table expression that I am using trying to use as an update statement. The only reason for the CTE is so I can use a where clause to filter by CredCount. I would like to use that where clause to update only records that match in this case CredCount of 2. However, I am having trouble
Should I use Effective Date or Start Date and End Date for historical recording?
I am a Business Analyst and have prepared tables/erd for a system we are implementing. The context is essentially an employee management system, an employee can join the company, change positions, get promoted, demoted, terminated etc. All of this is required to be tracked for filtering and reporting purposes…
Executing a SQL query with C#
I would like to add some information to my database. I searched for some tutorials, but none of them work. NonQuery can do what he needs to do, because the messagebox returns “Success” (1). But it does not update my database. If I put the same query to “Add New Query”, directly to my d…