1,166 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-3
votes
1
answer
143
views
Merge Rows into single column
I have a table in below format .
I am trying to merge columns and convert into row.
I tried doing that using PIVOT but it is taking column as entry and not allowing me to pass values.
Here is my ...
1
vote
2
answers
155
views
Combine Multiple Tables into Single Resultset
I have 4 tables with data shown here in SQL Server 2019 (RTM) -15.0.2005
Table 1: Buyer
ID
NAME
123
ABC
234
XYZ
456
MNO
Table 2: Sell Detail
Sl No
ID
TYPEID
A
123
1
B
123
2
C
123
3`
D
234
1
E
456
2
...
2
votes
2
answers
209
views
Join on one column and if null join another column
I need some help handling null columns in joins. I have three tables (below are just examples) Map, Employee and Region. Primary table is Map where I join Employee table on the MapID column to get ...
2
votes
2
answers
85
views
Query on SSRS Content table for reports with hyperlink action returns all reports
I am trying to identify only reports with a hyperlink to another report. I am using SQL Server 2019 (150).
My SQL:
SELECT
C.ItemID,
C.Name AS ReportName,
C.Path AS ReportPath,
CONVERT(...
1
vote
2
answers
131
views
Pivot multiple columns [duplicate]
I have a vertical table that end users want converted to a horizontal table with some groupings. I'm writing this in SQL Server 2019.
My table looks like this:
PKID
cID
vID
vDate
1
2
81
1996年04月04日
2
...
0
votes
1
answer
124
views
JSON column mapping – navigation property throws NullReferenceException
I have a model with a WorkFlow column in the database, defined as nvarchar(MAX) and storing JSON data. Previously, we treated it as a plain string in our C# entity, but I'm now trying to take ...
6
votes
2
answers
137
views
Parse multiple JSON items from a table cell
My table in SQL Server with an nvarchar(max) column holds multiple JSON arrays in each cell. I am trying to parse the 'result' items into separate rows.
JSON array:
[
{"successful":true,
...
2
votes
3
answers
129
views
Query count & sum nested selects into a Grouped Category
My current project/issue is we have a list of permit types. With these types they are needing to be grouped by an overall category. Once grouped out the end goal is to count how many within specified ...
-1
votes
1
answer
72
views
Parsing date & time from column in SQL
I've got a column that stores text and I'm trying to find a way to pull the datetime from the field. I've tried to use a combination of SUBSTRING,CHARINDEX, and LEN to pull the datetime from the ...
2
votes
2
answers
147
views
How do I solve a BCP utility error when importing a CSV?
My input files are on my local drive c:/, and I use Trusted Windows authentication to SQL Server.
All bcp discussions are quote old, I have a feeling that it has been replaced with something else (?). ...
3
votes
3
answers
153
views
Find dates common in different rows
I have a table which has 3 columns:
task_name -- data type is varchar(50)
start_date -- data type is date
end_date -- data type is date
I want to list the dates which fall within the range (between ...
0
votes
0
answers
93
views
SQL Server move table with constraints primary key
I have a table with clustered primary key. I want to move this table to separate file using filegroup.
As I understand - the best way to do it is to DROP and recreate the clustered index, but when I ...
0
votes
0
answers
80
views
Last Synch Date of Replicated Tables on SQL Server
This question is about SQL Server replication.
I am running SQL Server 2019 v15.0.4420.2 and I get a large number of replicated tables from outside the organisation.
What I am looking for is a SQL ...
-2
votes
2
answers
247
views
How can I make SELECT convert all columns to text?
Is there a way in Microsoft SQL Server to make SELECT * automatically convert all returned columns to text? Something like:
SELECT CONVERT(varchar, *)
FROM [Company]
I prefer not to address ...
2
votes
1
answer
156
views
How to calculate Subtotals in SQL Queries
I can’t calculate subtotal and total using GROUP BY ROLLUP syntax in a SQL Server 2019 database:
CREATE TABLE [dbo].[G_Dashboard]
(
[orderId] int NULL,
[C_CO] varchar(4) NULL,
[D_CO] ...