Viewing 15 posts - 946 through 960 (of 3,489 total)
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
SELECT y.EventDate
, y.EventHour
, COUNT(*) AS Freq
FROM
(SELECT x.EventDate,
DATEPART(hour,x.EventTime) AS EventHour
FROM
(SELECT '05/17/2019' AS EventDate, '00:51:39.0000' AS EventTime, 1 AS CallCount
UNION ALL
SELECT '05/17/2019', '06:54:34.0000', ...
May 20, 2019 at 6:27 pm
DATEDIFF with a CASE statement should do it.
May 14, 2019 at 4:46 pm
Why not just create a stored procedure to accept two parameters and then do two inserts? Sounds to me like you're making this waaaay more complicated than it should be.
May 9, 2019 at 10:56 pm
Any reason you couldn't take this and turn it into an INSERT statement into a table somewhere?
SELECT TOP 10
GETDATE() AS EventDate,
qs.total_worker_time/(qs.execution_count*60000000) as [Minutes Avg CPU Time], ...
May 9, 2019 at 9:29 pm
Can't help but wonder if the Top 5 change during the day/week. If so, it would make sense to include the execution date/time with the query name in the table....
May 9, 2019 at 8:47 pm
Maybe this? You don't need FILTER() if you are comparing a column value to a constant. You would need it if you were comparing a column to an aggregate.
May 6, 2019 at 8:25 pm
Viewing 15 posts - 946 through 960 (of 3,489 total)