Viewing 15 posts - 106 through 120 (of 1,315 total)
June 21, 2018 at 7:25 am
Does that really answer the poster who wants the parent table and child table...
June 21, 2018 at 6:39 am
Use a recursive CTE to order the foreign keys.
WITH FK AS (
SELECT RefTableId = referenced_object_id,
ChildTable = OBJECT_SCHEMA_NAME(parent_object_id) + '.' + OBJECT_NAME(parent_object_id),
ParentTable = OBJECT_SCHEMA_NAME(referenced_object_id)...
June 20, 2018 at 12:03 pm
A single 5-million row INSERT can be a huge problem, it may fill up the transaction log even if the database is in simple recovery. A minimally-logged bcp insert is...
June 13, 2018 at 10:05 am
It could be simplified a bit.SELECT a.Ach_ID, Winnings_2015 = COUNT(p.Player_ID)
FROM #Achievements a
LEFT JOIN #PlayersAchievments p ON p.Ach_ID = a.Ach_ID AND YEAR(p.Winning_Date) = 2015
GROUP BY a.Ach_ID
June 12, 2018 at 7:08 am
I alias the group names when registering them, especially for servers with named instances.
Server name: ACTUALSERVER\INSTANCE
Registered server name: XYZ servers
June 8, 2018 at 12:35 pm
I would use a script transform to do the conditional split.
http://www.sqlis.com/sqlis/post/Using-the-Script-Component-as-a-Conditional-Split.aspx
Assuming you want to use a round-robin row distribution technique, the code would look like...
June 7, 2018 at 12:21 pm
I don't see where you're filtering out only the rows that need to be updated.
This query should do it, although it assumes none of the invoice method values are...
June 7, 2018 at 12:01 pm
The user calling the procedure must have impersonation rights on the EXECUTE AS principal (either login or database user). You may want to create a readonly Reporting login or user...
June 1, 2018 at 10:29 am
PowerShell and Registered Servers are a great combination.
Problem: Run a PowerShell script on every SQL Server listed in any of your registered Central Management Servers.
# Get...
May 15, 2018 at 1:42 pm
I've been around long enough to remember when reading from a data file was just something you were expected to know how to do if you wanted to call yourself...
April 26, 2018 at 10:50 am
If index_id = 0, it is a heap and cannot be rebuilt (except by truncating and reloading all the data). You should create a clustered index on the table if...
April 5, 2018 at 11:57 am
The account running the job with sys.database_files must have CONNECT permission in each database, but sys.database_files is publicly readable and requires no additional permission. Databases that they can't connect to...
March 29, 2018 at 11:06 am
SELECT *, Combined = DATEADD(DAY, DATEDIFF(DAY, -2, TheDate), TheTime)
FROM (
VALUES ('05/12/2014', '1899-12-30 10:27:59.000'),
('05/12/2014', '1899-12-30 10:14:46.000')
) History(TheDate, TheTime)
TheDate TheTime Combined
05/12/2014 ...
March 29, 2018 at 10:44 am
SELECT ID, EMAIL
FROM (
SELECT ID, EMAIL, MostRecent = ROW_NUMBER() OVER (PARTITION BY EMAIL ORDER BY LAST_UPDATED_DT DESC)
FROM whatever
) m
WHERE...
March 29, 2018 at 10:26 am
Viewing 15 posts - 106 through 120 (of 1,315 total)