Viewing 15 posts - 2,251 through 2,265 (of 7,608 total)
As Phil noted, I can't actually test the code, since you didn't provide any directly usable data:
SELECT up.class, up.model, ca1.type
FROM dbo.u_parts up
CROSS APPLY ( VALUES([W20-13]),([W20-14]),([WorkLog]) ) AS...
October 2, 2020 at 7:08 pm
Glad it helped, thanks for the feedback!
If you need to split out the final string, you can use a tally table for that:
;WITH
cte_tally10 AS (
...
October 2, 2020 at 2:57 pm
Yet another version.
Non-serious note to Jeff Moden: See, I actually am willing to use an identity as the clustering key.
DECLARE @min_vals_in_sequence int
SET @min_vals_in_sequence = 3
DROP TABLE IF...
October 2, 2020 at 8:28 am
If you need both extracted values in the same row:
SELECT s.StuffId, ds2.email_name_1, ds2.email_name_2
FROM #Stuff s
CROSS APPLY (
SELECT
...
October 2, 2020 at 1:51 am
I think this will do it:
SELECT REPLACE(string, '000', '')
October 2, 2020 at 1:40 am
This code does include the date swap if they pass in a DateFrom that is greater than the DateTo.
if i need it to does not include date swap,...
October 1, 2020 at 4:50 pm
Do you use secondary filegroups? If you do, I'd create a new filegroup and files and do the data compression into that new filegroup. Then you can shrink the original...
October 1, 2020 at 4:23 pm
...
sum(CAST(size AS bigint))/128.0 AS File_Size_MB,
sum(CAST(FILEPROPERTY(name, ''SpaceUsed'') AS bigint))/128.0 as Space_Used_MB,
SUM(CAST(size AS bigint))/128.0 - sum(CAST(FILEPROPERTY(name,''SpaceUsed'') AS bigint))/128.0 AS Free_Space_MB
...
October 1, 2020 at 4:21 pm
OOPS, yeah, I forgot about the cross-db reference. I should not have put SCHEMABINDING in there.
October 1, 2020 at 4:11 pm
Here's how to calc the new selling price for any new net margin. (I always did love algebra.)
Edit: I didn't see Des's until after I had posted mine.
October 1, 2020 at 4:07 pm
Hmm, that task sounds like it should be a single INSERT statement, which means SQL should resolve GETDATE() only once. Therefore it seems as if your trigger is using a...
October 1, 2020 at 9:57 am
You don't need a calendar table for this. Also, note that the Friday check below works under any/all DATEFIRST settings. DATEFIRST is not something you want to change in your...
October 1, 2020 at 9:50 am
SELECT DATEADD(DAY, (@DaysDifference + 6) / 7 * 7, @OriginalFirstStartDate)
September 29, 2020 at 9:04 pm
The UPDATE "doesn't work" because since reserve is null, it will stay null, even though you think you "added 1 to it". NULL + 1 = NULL.
If you prefer, you...
September 29, 2020 at 8:58 pm
SELECT
Id,
MIN(CASE WHEN StatusName = 'Draft' THEN CreatedOn ELSE NULL END) AS Draft,
MIN(CASE WHEN StatusName =...
September 29, 2020 at 4:12 am
Viewing 15 posts - 2,251 through 2,265 (of 7,608 total)