[Solved] VBScript using WMI to find out SQL Server version

Based on the code in the first Google search result here: Dim WMI, Col, Prod, Q Set WMI = GetObject(“WinMgmts:”) Q = “Select * FROM Win32_Product WHERE Vendor = ” & _ “‘Microsoft Corporation’ AND Name LIKE ‘SQL Server%Database Engine Services'” Set Col = WMI.ExecQuery(Q) For Each Prod in Col if left(Prod.version, 3) = “11.” … Read more

[Solved] SQL group data based on a column and pivot rows to (unknown) columns [duplicate]

A straight-up PIVOT in concert row_number() with should do the trick Select * From ( Select ID = fd_Interpretation ,Item = concat(‘Word’,row_number() over (partition by fd_Interpretation order by fd_Word) ) ,Value = fd_Word From YourTable ) src Pivot ( max( Value ) for Item in ([Word1],[Word2],[Word3],[Word4],[Word5],[Word6],[Word7],[Word8]) ) pvt 2 solved SQL group data based on … Read more

[Solved] find 2nd highest salary in sql [closed]

Use this query SELECT MIN(s.Payment), e.EmpName, e.EmpID FROM dbo.Employee e INNER JOIN Salary s ON e.EmpID = s.EmpID WHERE e.EmpID IN (SELECT TOP 2 EmpID FROM dbo.Salary ORDER BY Payment DESC) 5 solved find 2nd highest salary in sql [closed]

[Solved] How do I convert a SQL server timestamp to an epoch timestamp? [duplicate]

You can do it using DATEDIFF function like below : select DATEDIFF(s, ‘1970-01-01 00:00:00’, ‘2017-11-20 23:12:02.000’) as EpochTimeStamp Output : EpochTimeStamp ————– 1511219522 You know already how can we get back the original date : SELECT DATEADD(ss, 1511219522, ‘19700101’) as OriginalDate OriginalDate ———————– 2017-11-20 23:12:02.000 solved How do I convert a SQL server timestamp to … Read more

[Solved] How to create a query for this scenario?

I think you can try this to obtain a list for all the users (left join with table user in this case is not enough – see my sample data below): SELECT C.USERNAME, A.CALENDARDATE , CASE WHEN B.USERNAME IS NULL THEN ‘Absent’ ELSE ‘Present’ END AS STATUS , CAST(B.WDT AS DATE) AS WDT, CAST(B.WDT AS … Read more

[Solved] How do I connect the local SQL Server database for the ASP.NET Core application running inside either local Docker or Kubernetes?

How do I connect the local SQL Server database for the ASP.NET Core application running inside either local Docker or Kubernetes? solved How do I connect the local SQL Server database for the ASP.NET Core application running inside either local Docker or Kubernetes?

[Solved] how can select all columns and one of them without rebeating [closed]

If you want to list the employees and the name of each employee’s department manager, you will need to join the Employee table twice. One way to do this is: Select Employees.* , Departments.* , Managers.EmployeeName as ManagerName From Employees Inner Join Departments on departments.DeptID = employees.DeptID Inner Join Employees managers on managers.EmpId = departments.ManagerID … Read more

[Solved] Is there any way to calculate age of a person based on DOB and quarter of the provided year sql server? [closed]

Using DATŠ•DD() and DATEPART() is an option: SELECT DOB FROM (VALUES (CONVERT(date, ‘19971207’)), (CONVERT(date, ‘19700607’)), (CONVERT(date, ‘19771207’)), (CONVERT(date, ‘19971108’)) ) d (DOB) WHERE DATEPART(year, DATEADD(year, 50, DOB)) = 2020 AND DATEPART(quarter, DATEADD(year, 50, DOB)) = 2 Result: DOB 1970-06-07 0 solved Is there any way to calculate age of a person based on DOB and … Read more

[Solved] What type of encryption is this [closed]

As mentioned by tadman, the $P$B signature suggests that this is probably a hash generated by the WordPress password hasher, so it can’t be reversed The WordPress password hasher implements the Portable PHP password hashing framework, which is used in Content Management Systems like WordPress and Drupal. You can generate hashes using this encryption scheme … Read more