All Questions
Tagged with query-refactor sql-server
7 questions
0
votes
0
answers
80
views
Sanity Check - Result set different after breaking up case expression in where clause into different selects w/union all
I'm back again with more dumb questions. This time I am dealing with refactoring a single select with nested case expressions in the where clause. I'm trying to optimize this, and in attempting to do ...
2
votes
1
answer
336
views
About Apex SQL Refactor and SSMS keyboard shortcuts being broken
Hi DBA Stack Exchange!
Today I tried Apex SQL Refactor and right from the get go, once installed and integrated into my T-SQL dev tool of Choice (SSMS 18.3.1) I noticed that some Keyboard shortcuts ...
1
vote
1
answer
63
views
Refactoring database after migrating table
I'm creating a new staging database, into which I intend to migrate several tables from the old database. These tables are referenced in functions and stored procedures. If I were doing things ...
1
vote
1
answer
678
views
Refactoring sql for tables with similar columns but different table names
I have the task of re-factoring a SQL script that performs a lot of unions from different tables. These tables have similar information, so the script queries the same columns as in each table, except ...
1
vote
1
answer
3k
views
Find Duplicate Customers
Okay... I have a table that has customers:
-- Individual Table
* ID (Internal Unique ID)
* IndividualID (External Unique Individual Identifier)
* Last Name
* First Name
* Birth Date
* SSN
* ...
The ...
7
votes
3
answers
23k
views
Is there a more concise way to convert a UTC datetime into a local date only?
I am trying to write a query that groups records based on the local date part only of a UTC datetime field.
For example, if my table contains 10/19/2012 2:00:00, then it should get grouped as 10/18/...
12
votes
3
answers
780
views
Are these two queries logically equivalent?
Are these two queries logically equivalent?
DECLARE @DateTime DATETIME = GETDATE()
Query 1
SELECT *
FROM MyTable
WHERE Datediff(DAY, LogInsertTime, @DateTime) > 7
Query 2
SELECT *
FROM ...