This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkFileExtension(file, ...allowFileTypes) { | |
const allowedExtensions = allowFileTypes; // List allowed extensions | |
const fileExtension = file.name.split('.').pop().toLowerCase(); | |
return allowedExtensions.includes(fileExtension); | |
} | |
function checkContentType(file) { | |
const allowedTypes = ['image/jpeg', 'image/png', 'application/zip', 'application/pdf']; // List allowed MIME types | |
return allowedTypes.includes(file.type); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @CurrentDate DATE = GETDATE(); | |
DECLARE @FirstDayOfPreviousMonth DATE; | |
DECLARE @LastDayOfPreviousMonth DATE; | |
-- Calculate the first day of the previous month | |
SET @FirstDayOfPreviousMonth = DATEADD(MONTH, DATEDIFF(MONTH, 0, @CurrentDate) - 1, 0); | |
-- Calculate the last day of the previous month | |
SET @LastDayOfPreviousMonth = EOMONTH(DATEADD(MONTH, -1, @CurrentDate)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BULK INSERT [dbo].[Designations] | |
FROM 'C:\Users\User\Desktop\Designation.csv' | |
WITH ( | |
FIELDTERMINATOR = ',', | |
ROWTERMINATOR = '\n', | |
FIRSTROW = 2 | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming employee.PermanentEndDate is DateTime? (nullable DateTime) | |
if (employee.PermanentEndDate.HasValue) | |
{ | |
var empPermanentEndDate = employee.PermanentEndDate.Value.Date; // Use .Date to ignore the time part | |
var today = DateTime.Today; | |
var previousDay = DateTime.Today.AddDays(-1); | |
if (empPermanentEndDate == previousDay && previousDay == today) | |
{ | |
// Do something if empPermanentEndDate is the same as yesterday and today |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use HRMS | |
go | |
update Employees set Department_Branch_Id = Departments.Department_Id | |
from Departments | |
WHERE Departments.Name = Employees.DepartmentName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DTExec.exe /file "D:\filepath" /de "something" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.extend(true, $.fn.dataTable.defaults, { | |
processing: true, | |
responsive: true, | |
mark: true, | |
order: [[0, "desc"]], | |
iDisplayLength: 5, | |
aLengthMenu: [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]], | |
layout: { | |
topStart: { | |
buttons: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DATEADD(MINUTE, DATEDIFF(MINUTE, GETUTCDATE(), CURRENT_TIMESTAMP), event_time) AS event_time_afterconvert, | |
getdate() 'Current_system_time' | |
,statement --for reason | |
,* | |
FROM fn_get_audit_file('D:\code\SSMS\Audit\*', DEFAULT, DEFAULT) WHERE action_id = 'LGIF' -- LGIF mean Login Fail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
s.session_id, | |
s.login_name, | |
s.host_name, | |
s.status, | |
s.last_request_start_time, | |
s.last_request_end_time, | |
r.cpu_time, | |
r.total_elapsed_time, | |
r.reads, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PRINCIPAL_AMOUNT*(INTEREST_RATE/100)/INT_BASIS*TERM |
OlderNewer