Microsoft SQL Server Management Studio 2017 is a graphical tool for configuring, managing, and administering all components within Microsoft SQL Server. Use this tag specifically for questions related to Microsoft SQL Server Management Studio 2017.
Questions tagged [ssms-2017]
188 questions
-1
votes
1 answer
I want to create table or view from a recursion used to generate a date in ssms
I wrote a recursive query to generate a column pf dates. I want the dates to be stored as a table in a db but can't seem to find a way.
declare @startdate date = '2014-01-01';
declare @enddate date = '2023-12-31';
with calendar as
(
select…

oyelowo toyyib
- 3
- 1
-1
votes
1 answer
SQL server find previous sales based on previous draw for the same day
I have below dataset
I'm looking for an SQL server query to get below output that will calculate previous sales based on previous draw number for the same day

Pravesh Loto
- 9
- 4
-1
votes
1 answer
Select Top 1 Subquery in Select Statement Returning Null
I am attempting to pull 1 row per individual and need to add a column with the date of the most recent progress note for that individual, if there has been none completed, then null is correct.
Pulling the progress note date in the select statement,…

Chris
- 1
- 2
-1
votes
1 answer
Average of a player
I have a record that contains stat for a certain cricket player.
It has columns having dates, oppositions, Runs, Balls, Dismissals, Match_Number.
I want to do a query (SQL SERVER) to find out the batting average where every runs (Sum) is to be…
-1
votes
1 answer
Win Service works as Console Application but not as Windows Service
I created a Console Application service using Topshelf 4.2.1. to use it like a windows service.
I am using Dapper to get data and update Microsoft SQL Server, I get the connections strings from app.config as well as constants in (folder path,…

Daniel Gheorghe
- 1
- 1
-1
votes
1 answer
Getting error: Subquery returns more than 1 value
I just run this query:
select
sc.Studentid as [Student ID], StudentName, semester,
sum(c.credit) as Creditsemester,
cast(sum(w.[Weight]*c.credit) / sum(c.credit) as decimal(5, 2)) as [Semester GPA],
(select sum(c.credit) from…
-1
votes
1 answer
Make a master record out of several duplicate records for each id
My table structure is as shown below
Id | Name | City | Country | State
01 | Bob | *NY* | null | null
01 | Bob | null | *US* | null
01 | Bob | null | null | *AL*
02 | Roy | *LA* | null | null
02 | Roy | null | *IN* …

Salva
- 81
- 1
- 9
-1
votes
2 answers
CAN THE COUNT FUNCTION IN SQL SERVER DB ACCEPT MULTIPLE VALUES
I am querying the very popular AdventureWorks DB in SSMS.
My objective to find the number of males and females under each job title from HumanResources.Employee.
For this my original query was,
SELECT JobTitle,
COUNT(CASE WHEN Gender='M' THEN 1
ELSE…

halfwind22
- 329
- 4
- 18
-1
votes
3 answers
Common records from SQL table
I have 3 tables called CompanyInfo , IDInfo and PersonalInfo.
The objective is to fetch P.[First Name], P.[Last Name], I.PAN, C.DOB.
I can put left join or right join to cater this but the sequence of tables may change as it is an input to some…

ramverma
- 1
-1
votes
1 answer
How to create a trigger that automatically update a datetime column when a field of the table is updated
i am trying to create a column that measures the UPDATE_DATE of a row.
I am building a trigger but i have an ambiguity problem regarding the key.
CREATE TRIGGER ModDate_location_update
ON dim_Location
AFTER UPDATE
AS
BEGIN
UPDATE…
user11624251
-1
votes
1 answer
SQL Server 2017 stand-alone stuck
It's second time i was install SQL server 2017 on window 10
Getting stuck on installation progress error as below
sql_inst_mpyConfigAction_Install_Confignonrc_Cpu64

Syan
- 137
- 1
- 5
- 17
-1
votes
2 answers
List databases under instances not connected to
How do I find out what databases are listed under an instance that I'm not connected to?
(this is homework...sort of)
I found out how to locate other instances through Admin Tools, then Services. But I don't know if there is a way to list all the…
-1
votes
4 answers
convert time from 1530 into 3:30 PM Time Format SQL Server
Trying to convert time from 1530 into 3:30 PM time format in SQL server.
Times = 1530
I have tried:
convert(time,LEFT(Times,2)+':'+right(Times,2))
Results: 15:30:00.0000000
But it is in 24 Hrs, I want to convert into 3:30 PM. And Remove…

Tarak Pandya
- 29
- 5
-1
votes
1 answer
Perform a Series of Calculations on a Multiple CTE Table
Can't seem to figure out the formula for performing a series of functions on my query. I need to subtract the figures in the DIF column depending on the STAT code. I need to perform the same series of functions in every case. STAT I0099 MINUS E0002,…

Erikah
- 13
- 1
- 5
-1
votes
1 answer
Recursive/looping query help needed with ROW_NUMBER
I want to be able to trace backwards through a table of movement of materials, equipment used to move it and timings, starting at a specified value in a field and finding that value in another field in different row(s) based on a shared value.
In…

Jimbo
- 67
- 9