Viewing 15 posts - 931 through 945 (of 3,480 total)
I formatted it.. I got lost in the CTE stuff because I wasn't following all the logic. I would definitely comment the chunks just to make it easier for other...
June 29, 2019 at 7:32 pm
In the absence of better code, this is what I came up with. I'm assuming you have a table of holidays like #Holidays table. Then you just check for the...
June 28, 2019 at 3:17 am
Shouldn't your WHERE clause be like this?
WHERE SoftwareTitle NOT IN ( SELECT <fieldname> FROM #TempTable)
You can't match a single column (SoftwareTitle) to all the columns (*) in #TempTable
June 16, 2019 at 12:59 am
Something like this?
SELECT *
FROM CustInfo ci
WHERE DateCreated IN ( SELECT DateCreated
FROM CustInfo
WHERE EntryType = 'Expired')
AND ci.EntryType != 'Expired';
(Sorry, I renamed your table to CustInfo).
June 12, 2019 at 6:45 pm
Without CREATE TABLE and INSERT scripts (sample data), there's no way to answer your question.
What does "didn't work" mean?
June 11, 2019 at 5:59 pm
I think having a slide so attendees can decide whether the presentation will benefit them is a good idea. I think it would be a good idea to include that...
June 10, 2019 at 11:24 pm
Maybe this will help (?)
use tempdb;
go
declare @SomeDate DATE = '2019-05-31';
SELECT @SomeDate AS TextDate,
DATEADD(day,1,CAST(@SomeDate AS DATE)) AS NextDay,
YEAR(CAST(@SomeDate AS DATE)) AS SomeYear,
CONCAT(CONCAT(DATENAME(month,CAST(@SomeDate AS DATE)),' '), YEAR(CAST(@SomeDate AS DATE)))...
June 6, 2019 at 4:10 am
Set up cascading deletes between the parent and child tables, and just delete from the parent table?
Or use a trigger to get the IDs from the deleted virtual table and...
May 30, 2019 at 7:09 pm
Second Step:- Then I want to compare each B_time if It is 30m different then Sum(b_rate) and total count.?
30m different from what? the previous record? Use LAG() for that. Then...
May 30, 2019 at 2:36 am
You need Jeff Moden's DelimitedSplit8K function to do that.
Here's how to use it... (but do read the article - it's really good!)
CREATE TABLE SomeData(emailaddr VARCHAR(20), Repeating...
May 29, 2019 at 11:32 pm
Or use CROSS APPLY... but the above is probably easier.
SELECT p.Id
, p.Surname
, p.Bed
, p.OpDate
, patientData.SampleDate
, patientData.BP
, patientData.Temp
FROM Patient p
CROSS APPLY (SELECT TOP 1 ID, BP, Temp, SampleDate
FROM...
May 29, 2019 at 2:18 pm
What if you used ROWNUMBER() OVER (PARTITION BY StudentID) and then pivoted on that?
May 28, 2019 at 7:51 pm
Maybe read Jeff Moden's article on pivoting in T-SQL. Otherwise, could you post a CREATE TABLE script and an INSERT script to show some sample data?
Sounds like you need a...
May 28, 2019 at 4:06 pm
This might help:
https://stackoverflow.com/questions/3560173/store-arabic-in-sql-database
You have to change the collation for the various columns and use NVARCHAR() and NCHAR() because you need Unicode support.
May 21, 2019 at 8:22 pm
If you have a table for the times
CREATE TABLE HoursList (
HourNumber TINYINT PRIMARY KEY
, TimeSpan VARCHAR(10) NOT NULL
);
Then you insert values for each
INSERT INTO HoursList(0, '12 AM-1 AM'),(1,'1 AM -...
May 21, 2019 at 3:44 pm
Viewing 15 posts - 931 through 945 (of 3,480 total)