I believe my question is kinda simple but I haven’t found something like that upon searching. I want to insert into a table testing multiple rows for example: (’03’,’ENG’,’203′) (’03’,’ENG’,’403′) (’03’,’ENG’…
Tag: sql-server
Evaluate Multiple conditions for same row
I have to compare 2 different sources and identify all the mismatches for all IDs Source_excel table Source_dw table Expected result I have tried the below query but it is giving only one mismatch. Actual output I understand that case expression will only check the first satisfying condition. Is there any oth…
Stored procedure to unpivot
I have a table with these columns: Where fields from 01 to 50 are dates. I need to have a table like this: Where title code should be the column name from 01 to 50, data should be the value of that column in mytable I did this stored procedure by looking in older questions: but I’m getting a syntax
Combine data of double rows as output
I have an example table with Ids and Names, I would like to get a new table with unique Ids and the names of one column combined (grouped by ID). My data looks like this (SQL Server 2017 & 2019 – SSMS): My goal is to get the following output with a qry: Does anybody has a tip/suggestion how to
How can I create a SQL Server stored procedure which can produce a table combining three tables
I have three SQL tables as below. Table #1: Benchmark WorkLoadType MaxUsersperVCpu vCPU RAM MaxUserCapacity ———————————————————— Light 6 …
SQL query to get rows contains value of another query
I have 2 tables transaction and query. Transaction table have unique tid and the query table has tid_(subtransactionid). I want to get the list of all subtransactions by using tid. I tried this Answer You can join the tables and use the operator LIKE in the ON clause: If your database does not support the fun…
Error converting data type nvarchar to numeric convert/cast
I suspect this has to do with reporting ClientName, which is a nvarchar data type. AUMid is nchar. I’m not sure how to work around this without changing the data types (which I prefer not to). I need to display Clients.ClientName. It is linked to the AUM table via AUM.AUMid. Removing SUM(AUM.AUM * AUM.M…
Deleting duplicate rows with primary keys that are connected to other tables
A process was causing duplicate rows in a table where there were not supposed to be any. There are several great answers to deleting duplicate rows online. But, what if those duplicates with ID primary keys all have data in other tables tied to them? Is there a way to delete all duplicates in the first table …
How to create nested tables in SQL Server
I don’t understand how to create nested tables. My project is about beer. I have different coolers for sale, and each has a capacity for n number of beers. Each cooler comes preloaded with beers, and …
Matching and unlatching records in a single table sql server
I have procedure where I am getting data from my 1st temp table like below 2nd temp table like below Now I need to join this 2 temp tables to get all matching and unmatching data .My result would be like below But I am getting only matching data.Please help how to do Answer I think that’s a full join: