336,500 questions
-3
votes
0
answers
53
views
Similar scripts are working for one table and not another [closed]
My trigger is not working, I have the exact same trigger for other tables, and they work fine, but for some reason this one does not.
ALTER TRIGGER [dbo].[tgr_PatientPanel_PCP_ChangesPNLstamp]
ON [HH-...
-4
votes
1
answer
61
views
Matching on dates when a MM/DD combination needs to be excluded [closed]
I've been tasked to write a query where a month and date combination from one column needs to not equal another date column.
i.e. MED_EFF_DATE = 06/01/XXXX and MED_CANC_DT NOT EQUAL 08/29/XXXX
I've ...
Best practices
0
votes
3
replies
68
views
How can I help developers' local SQL Server database stay in-sync with the latest main branch's schema?
I'm trying to come up with an elegant solution for a common problem we have on our development team. The problem is ...
Developers are working on Git feature branches. They may need to modify the SQL ...
Best practices
0
votes
5
replies
71
views
Is TransactionScope still the best way to wrap DB code in a transaction you can roll back?
First, let me say that I'm working in the context of an extremely old ASP.NET app with objects that do their own SqlClient operations from within. It does not use repositories or an ORM, not even EF. ...
0
votes
0
answers
12
views
Service Broker Cross-DB conversation failed [migrated]
I am trying to implement sending messages from my production db to my auditDb.
The Service Broker is suitable for it.
I send message from the InitiatorDb to the TargetDb. If TRUSTWORTHY=ON then it ...
Advice
0
votes
0
replies
64
views
Should I create a clustered index on a data warehouse fact table?
I work with a SQL Server data warehouse, where performance from both the load and query perspective is often important. There are a number of fact tables without a primary key.
One legacy table (80M ...
Advice
0
votes
6
replies
85
views
Choosing database in Azure
I'm testing with a mobile app and webapp that both currently communicate through a local API with my local SQL Server database. There are three tabels and these all have less than 100 rows and about 6 ...
0
votes
2
answers
159
views
SQL for pivoting
I have generated a view in SQL Server; it is basically a payslip table with different rows for the same employee for the same month.
I want to get the whole thing into a single row i.e one row per ...
Advice
2
votes
6
replies
132
views
Parsing a field into multiple records
I'm not sure how to name what I want to do, or even if it's possible, but this is my situation. I have a table with 2 fields: ACCOUNTS & PROGRAMS. The PROGRAMS field is a concatenation of a ...
Advice
1
vote
1
replies
54
views
Is there an exercise repository for AdventureWorks database tables?
I am currently practicing SQL using the AdventureWorks sample database.
Before posting, I tried searching but couldn’t find a structured collection of exercises specifically designed for practicing ...
0
votes
0
answers
122
views
SQL JOIN returning duplicate rows instead of expected results [duplicate]
I am trying to combine data from two tables using a JOIN, but I am getting duplicate rows in the result instead of the expected output.
Here are my tables:
Customers
CustomerID
CustomerName
Orders
...
Advice
1
vote
6
replies
157
views
SQL correlated query
Could someone please explain the correlated query below.
I am unclear about comparing a table to itself via a correlated query.
How does the inner query compares with outer query with same table?
...
1
vote
1
answer
123
views
'offset ... fetch next ...' doesn't work as subquery
I'd like to create a temporary table with range of ids to reuse them in other queries. When I try this:
select ca.company_id
from company_account ca
order by ca.id desc
offset 0 rows
fetch next ...
Advice
0
votes
2
replies
67
views
Dapper - User Guide On Connections
I cannot see where all the connection types & ways to implement & manage said connections are in Dapper to connect to my SQL Server db...?
EDIT - Sorry cannot post update so trying to edit - ...
Advice
0
votes
0
replies
83
views
Recommended methods for migrating large yahoo mail inbox with attachments to SQL Server
Ultimate Goal: To export a massive Yahoo Mail + mailbox with attachments and images to SQL Server
I have a client that has a huge yahoo plus inbox that they are doing away with as they migrate all ...