April 8, 2019 at 5:05 pm
Copying text from a post
Dear Experts,
i need help in calculating time difference between two dates portion by Date, the difference will be calculated with the first day last Attendance = 1 with very next Attendance =1 of next day. and same will repeat second day last Attendance = 1 with very next Attendance =1 of next day.
Sample data SQL:
Drop Table #tmp_employees
CREATE TABLE #tmp_employees
(
Name VARCHAR(30) NULL,
EmployeNo VARCHAR(30) NULL,
Date DATETIME NULL,
Value INT NULL,
Attendence INT NULL
--,[Calculate Hr's difference] INT NULL
)
GO
insert into #tmp_employees
Values
('John','123','3/29/19 9:00 AM','10','0'),
('Raju','234','3/29/19 10:00 AM','20','0'),
('Chris','345','3/29/19 10:00 AM','50','1'),
('Ram','654','3/29/19 9:00 AM','10','1'),
('Robart','345','3/29/19 12:00 PM','10','0'),
('John','123','3/30/19 9:00 AM','10','0'),
('Raju','234','3/30/19 9:10 AM','20','1'),
('Chris','345','3/30/19 9:00 AM','50','1'),
('Ram','654','3/30/19 9:00 AM','10','1'),
('Robart','345','3/30/19 9:00 AM','10','0'),
('John','123','3/31/19 9:00 AM','10','0'),
('Raju','234','3/31/19 9:20 AM','20','1'),
('Chris','345','3/31/19 9:00 AM','50','0'),
('Ram','654','3/31/19 9:00 AM','10','0')
I need some answer
April 8, 2019 at 5:06 pm
Copying text from a post Dear Experts, i need help in calculating time difference between two dates portion by Date, the difference will be calculated with the first day last Attendance = 1 with very next Attendance =1 of next day. and same will repeat second day last Attendance = 1 with very next Attendance =1 of next day. Sample data SQL:
Drop Table #tmp_employees
CREATE TABLE #tmp_employees
(
Name VARCHAR(30) NULL,
EmployeNo VARCHAR(30) NULL,
Date DATETIME NULL,
Value INT NULL,
Attendence INT NULL
--,[Calculate Hr's difference] INT NULL
)
GO
insert into #tmp_employees
Values
('John','123','3/29/19 9:00 AM','10','0'),
('Raju','234','3/29/19 10:00 AM','20','0'),
('Chris','345','3/29/19 10:00 AM','50','1'),
('Ram','654','3/29/19 9:00 AM','10','1'),
('Robart','345','3/29/19 12:00 PM','10','0'),
('John','123','3/30/19 9:00 AM','10','0'),
('Raju','234','3/30/19 9:10 AM','20','1'),
('Chris','345','3/30/19 9:00 AM','50','1'),
('Ram','654','3/30/19 9:00 AM','10','1'),
('Robart','345','3/30/19 9:00 AM','10','0'),
('John','123','3/31/19 9:00 AM','10','0'),
('Raju','234','3/31/19 9:20 AM','20','1'),
('Chris','345','3/31/19 9:00 AM','50','0'),
('Ram','654','3/31/19 9:00 AM','10','0')I need some answer
I'm quoting a reply here. Have you thought about actually trying some differnet code. Maybe you want to try this code, or something similar:
EXECUTE AS USER = 'SallyDev'
GO
EXEC sp_columns @table_name = 'Articles'
GO
REVERT
April 10, 2019 at 6:55 pm
Trying some bbcode here.
This is bold if it works.
This is italics
This is bbcode italics
This is code below
Select *
from pleasework
April 10, 2019 at 6:57 pm
bold test
April 10, 2019 at 7:03 pm
Normal user trying to format code
DECLARE
@MyDate DATE = '2015-08-27'
, @MyTime TIME = '15:33:21.057';
SELECT MyDateTime1 = CAST(@MyDate AS DATETIME) + CAST(@MyTime AS DATETIME);
April 10, 2019 at 7:41 pm
Abnormal user trying some of this too
<b> manual bold </b> to see if that works.
Toolbar bold
asdf
April 10, 2019 at 7:43 pm
My bad...duh...
manual bold using the brackets
April 10, 2019 at 7:51 pm
My bad...duh... manual bold using the brackets
So manual works as well.
URLs -
This goes to storage engine blog and of course MS has no broken links
April 10, 2019 at 7:56 pm
Earlier today, I had to clear my cookies for SSC to get the toolbar and for all of this to work. That may be why others are still complaining. The only time it didn't work since was a user error.
April 10, 2019 at 10:14 pm
Thanks, Sue. I'll make a note about clearing cookies in a few posts.
April 17, 2019 at 7:46 pm
This is some PoSh
$loops = 10000
$i = 1
$server = "Plato\SQL2017"
$db = "OneThousand"
$start = Get-Date
while ($i -lt $loops) {
$number = Get-Random -Maximum 1000 -Minimum 1
$query = "insert mytable" + $number + " select " + $number + ", replicate(CHAR(65), 1000)"
Invoke-Sqlcmd -ServerInstance $server -Database $db -Query $query
#write-host($number)
$i = $i + 1
}
$end = Get-Date
$Interval = New-TimeSpan -End $end -Start $start
write-host($start)
Write-Host($end)
write-host($Interval)
Hope it looks good
April 24, 2019 at 2:30 pm
Copying text from a post Dear Experts, i need help in calculating time difference between two dates portion by Date, the difference will be calculated with the first day last Attendance = 1 with very next Attendance =1 of next day. and same will repeat second day last Attendance = 1 with very next Attendance =1 of next day. Sample data SQL:
Drop Table #tmp_employees
CREATE TABLE #tmp_employees
(
Name VARCHAR(30) NULL,
EmployeNo VARCHAR(30) NULL,
Date DATETIME NULL,
Value INT NULL,
Attendence INT NULL
--,[Calculate Hr's difference] INT NULL
)
GO
insert into #tmp_employees
Values
('John','123','3/29/19 9:00 AM','10','0'),
('Raju','234','3/29/19 10:00 AM','20','0'),
('Chris','345','3/29/19 10:00 AM','50','1'),
('Ram','654','3/29/19 9:00 AM','10','1'),
('Robart','345','3/29/19 12:00 PM','10','0'),
('John','123','3/30/19 9:00 AM','10','0'),
('Raju','234','3/30/19 9:10 AM','20','1'),
('Chris','345','3/30/19 9:00 AM','50','1'),
('Ram','654','3/30/19 9:00 AM','10','1'),
('Robart','345','3/30/19 9:00 AM','10','0'),
('John','123','3/31/19 9:00 AM','10','0'),
('Raju','234','3/31/19 9:20 AM','20','1'),
('Chris','345','3/31/19 9:00 AM','50','0'),
('Ram','654','3/31/19 9:00 AM','10','0')I need some answer
Testing quotes
April 25, 2019 at 2:13 pm
Steve Jones - SSC Editor wrote:Copying text from a post Dear Experts, i need help in calculating time difference between two dates portion by Date, the difference will be calculated with the first day last Attendance = 1 with very next Attendance =1 of next day. and same will repeat second day last Attendance = 1 with very next Attendance =1 of next day. Sample data SQL:
Drop Table #tmp_employees
CREATE TABLE #tmp_employees
(
Name VARCHAR(30) NULL,
EmployeNo VARCHAR(30) NULL,
Date DATETIME NULL,
Value INT NULL,
Attendence INT NULL
--,[Calculate Hr's difference] INT NULL
)
GO
insert into #tmp_employees
Values
('John','123','3/29/19 9:00 AM','10','0'),
('Raju','234','3/29/19 10:00 AM','20','0'),
('Chris','345','3/29/19 10:00 AM','50','1'),
('Ram','654','3/29/19 9:00 AM','10','1'),
('Robart','345','3/29/19 12:00 PM','10','0'),
('John','123','3/30/19 9:00 AM','10','0'),
('Raju','234','3/30/19 9:10 AM','20','1'),
('Chris','345','3/30/19 9:00 AM','50','1'),
('Ram','654','3/30/19 9:00 AM','10','1'),
('Robart','345','3/30/19 9:00 AM','10','0'),
('John','123','3/31/19 9:00 AM','10','0'),
('Raju','234','3/31/19 9:20 AM','20','1'),
('Chris','345','3/31/19 9:00 AM','50','0'),
('Ram','654','3/31/19 9:00 AM','10','0')I need some answer
Testing quotes
Is this quoted?
April 26, 2019 at 2:07 pm
A bit more code to check
SELECT a.PharmNo, a.ClaimNo, a.ClaimDate, b.PharmNo, b.ClaimNo, b.ClaimDate
FROM Claim AS a
INNER JOIN Claim AS b ON a.PharmNo = b.PharmNo AND a.ClaimDate < b.ClaimDate WHERE wehaveosmething = somevalue and someothervlaue <> areallybadvalue or user_id = 'Steve' and logicalconstructs = 'this doesn't make sense';
May 7, 2019 at 7:21 pm
Spacing...
SELECT
sp.state_desc,
sp.permission_name,
p.name,
sp.class_desc
FROM sys.server_permissions AS sp
JOIN sys.server_principals AS p
ON sp.grantee_principal_id = p.principal_id
WHERE permission_name = 'VIEW SERVER STATE'
--after some inserted lines...
SELECT
p.[name],
sp.permission_name,
sp.state_desc,
sp.class_desc
FROM sys.server_permissions AS sp
JOIN sys.server_principals AS p
ON sp.grantee_principal_id = p.principal_id
WHERE p.[name] = 'YourTestLogin'
--and some more breaks pasted from SSMS
--comment
EXEC sp_dbfixedrolepermission
Viewing 15 posts - 1 through 15 (of 18 total)
You must be logged in to reply to this topic. Login to reply