Viewing 15 posts - 3,811 through 3,825 (of 7,614 total)
I prefer the format "<table_name>__DF_<column_name>". I think it's more useful to prefix constraints with the table name rather than "DF_". Just because MS did it that way doesn't mean it's...
May 24, 2017 at 10:28 am
The second-highest score should always give you the desired value:
SELECT t.ID, t.Score1, t.Score2, t.Score3, ca1.FinalScore
FROM #tmp t
CROSS APPLY (
SELECT TOP...
May 23, 2017 at 12:12 pm
If the tables are not too large, you could even consider using CASCADE only when deliberately making changes, i.e., drop the FK constraints, recreate them as CASCADE, change the name(s),...
May 23, 2017 at 11:24 am
Just UNION (not UNION ALL) the two tables:
SELECT *
FROM #temp1
UNION
SELECT *
FROM #temp2
ORDER BY <column_name>
May 23, 2017 at 10:57 am
You can use your initial DELETE, perhaps looping it as well:
DELETE TOP (50000) FROM WHERE DATE BETWEEN X AND Y;
You'd be better off clustering...
May 15, 2017 at 12:28 pm
Try this:
SELECT T.InvoiceNumber, T.EntryCode AS InvoiceEntryCode, T.StoreNumber AS InvoiceStoreNumber, T.RptLevel AS InvoiceRptType,
OA1.*
FROM #tmpTransactions T
OUTER APPLY (
SELECT TOP...
May 11, 2017 at 3:17 pm
You should look into using sql_variant data type, it could help you do this. You'd have to use the desired data type, or cast to an explicit type, when loading...
May 10, 2017 at 4:06 pm
For now, off the top of my head, I don't see any way to avoid a cursor. so that you can dynamically evaluate each expression using sp_executesql. But other than...
May 9, 2017 at 9:00 am
And don't forget about extended properties. Those would all be lost too if you DROP/CREATE. As would of course any original "create_date".
May 5, 2017 at 8:30 am
Change your table to never store the space in the post code column (you can use a trigger to do this, at least until you change the app; you can...
May 3, 2017 at 4:05 pm
If the format is always xxx###, then:
SELECT MAX(RIGHT(column, 3))
May 3, 2017 at 4:00 pm
Here's another alternative. Btw, I corrected two holiday descriptions, for Jan and Feb. It's not "President's Day", it's "[George] Washington's Birthday"; I wish the media would stop repeating the wrong...
May 2, 2017 at 1:18 pm
I think something along these lines:
SELECT user,
CASE WHEN confirmed_count = user_count THEN 'Confirmed'
WHEN not_confirmed_count > 0 THEN 'Not Confirmed'
WHEN confirmed_with_caveat_count >...
May 2, 2017 at 8:31 am
Viewing 15 posts - 3,811 through 3,825 (of 7,614 total)