336,330 questions
Score of 2
1 answer
174 views
Query that shows if a member meets defined metrics from the metrics table
I am trying to figure out how to write a query that can show me if a member meets defined metrics from our metrics table. There is a table that holds member survey answers and we have business ...
Score of -3
0 answers
59 views
Problem facing while migration Data NAV16 to NAV16 in the Database [closed]
I’m currently working on a Microsoft Dynamics NAV 2016 to NAV 2016 data migration project, and I’m facing a challenge where I’d really appreciate some guidance from people who have handled similar ...
Advice
0
votes
1
replies
94
views
Does SQL Server 2016 Database support built in sharding? If it is then what's the standard way to do this?
Does SQL Server 2016 support database sharding as a native feature? If so, what is the standard method for implementing it?
If not, is table partitioning the recommended alternative for managing data ...
Score of -3
0 answers
73 views
Calc with Power not showing correct Value [duplicate]
I have a formula that I am trying to use in SQL and the value I get is different from when used in Excel. Can you see if the SQL needs to be tweaked to get the correct value?
Excel formula - for test ...
Advice
0
votes
5
replies
116
views
Group By Help - Msg 8120, Level 16, State 1, Line 1
I'm getting an error saying Service.Name does not exist but I can clearly see it in my table.
Query
SELECT TY.Name
,SER.Name
,PAK.[1_Year]
,PAK.[3_Year]
,PAK.[5_Year]
FROM [...
Score of 0
1 answer
140 views
If product code does not exist in first part of query pull a declared value from another table for that product code
The first table I have stores fixed prices on product codes SellPriceRule and I show the query I have to get the list I want. The problem is for certain customers - using 1 as an example 7000192 - the ...
Score of 0
1 answer
179 views
Add a column to select query but exclude from grouping
I have the following query:
SELECT
MAX(F.Surname + ', ' + F.First_Name) AS Female,
ISNULL(MAX(M.Surname + ', ' + M.First_Name),'') AS Male,
MAX(CP.Comp_Date) AS Comp_Date,
H....
Score of 0
0 answers
119 views
Legacy SQL Server jobs for data migration issues
We handle data migrations using scheduled SQL Server jobs.
A month ago, I got a new requirement to migrate the last_add2, batch_no_all, and box_num2 values from a remote database. I updated the stored ...
Advice
0
votes
2
replies
78
views
Copying data from Oracle to SQL Server, with logic to reorganize data
My company has a customer that holds a large amount of data in the Oracle NetSuite product. This uses a very complicated data model. For fast reporting of the data, my company has provided our ...
Advice
1
vote
4
replies
182
views
How can I show only the first instance of a SQL count?
In SQL Server, I have table myTable with fields patientID, orderID, and orderDesc. patients can have multiple orders with individually variable descriptions.
I’m requested to write a query to select ...
Advice
0
votes
1
replies
82
views
Using timeout for Python's pyodbc
I am working on a project where I would need to query from MSSQL server. I am using Python and pyodbc for the work, and I want to use timeout for QUERY EXECUTION. But there is no direct way. Is there ...
Score of -2
0 answers
128 views
Create DSN for SQL Server with Username and Password
How to automatically create DSN for connection to SQL Server with supplied username and password?
The following code I have used worked if I am not supplying username and password, but I need the one ...
Score of 2
1 answer
136 views
Unexpected behavior with using a CTE to update a temp table
DDL:
IF OBJECT_ID('tempdb..#Tab2And3Pop') is not null
DROP TABLE #Tab2And3Pop;
SELECT CAST(115704 AS INT) AS ConflictNoticeID
, CAST(16003573 AS INT) AS MerchantID
, CAST(13 AS ...
Advice
0
votes
8
replies
92
views
T-SQL hint to block key lookup, without forcing a particular index
Is there an index hint in T-SQL that says "do not use any nonclustered index that would require a key lookup"? Apart from that one restriction, I want to let the query planner have a free ...
Best practices
0
votes
1
replies
89
views
How do I find every view and function that uses a specific column in SQL Server?
I'm working on an old SQL Server database where the main table has columns with generic names like MSTFLG01, MSTFLG02, all the way up to MSTFLG67. The actual meaning of each column is hidden inside ...