Skip to content
Advertisement

Tag: tsql

Printing integer variable and string on same line in SQL

Ok so I have searched for an answer to this on Technet, to no avail. I just want to print an integer variable concatenated with two String variables. This is my code, that doesn’t run: It seems like such a basic feature, I couldn’t imagine that it is not possible in T-SQL. But if it isn’t possible, please just say

Join two tables and concatenate multiple rows of a single field

Query: Current Output: Desired Output: I would like to join two tables, #Table1 and #Tabl2, on a key column, ID, and get Value field from the 2nd table… but in a single row (as shown in desired output). How (if possible) can I achieve the Desired Output? Thank you Answer For SQL Server 2017 and Later Versions Result Set

Execute a Stored Procedure Inside a View?

I started working for a company a few weeks ago, and have inherited a crazy mess of databases. I’m currently working on designing the new systems to replace their older ones. The previous developer created a ton of views that are entirely identical, with the only differences being the conditions within the WHERE clause. In my attempt to cleanup the

How to compare records in a SQL Table

I have a table name TransactionTable. If InsuranceCode = ‘ADAP’ and IsADAP = 1, I have to filter these records and return the remaining records. I am trying to write something similar to this syntax. Total records in TransactionTable is 1832 and Total records on filtration criteria is 109. I expect 1723 records as output. Below syntax returns only 785

SQL SERVER Insert Addition?

So this seems like something that should be easy. But say I had an insert: and I wanted X to go from 1-100. (Knowing there are some of those numbers that already exist, so if the insert fails I want it to keep going) how would I do such a thing? Answer Here’s a slightly faster way

Advertisement