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
Tag: tsql
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
Getting records with month by month, year by year and day by day from SQL Server
I’m looking for a fast and easy SQL Query to get records year by year, month by month and day by day. My database example: ID – DATE – CatID – VALUE 1 – 2013-08-06 – 32 – 243 2 – 2013-…
Distinct random time generation in the fixed interval
I’m trying to generate a random time between 8:00 AM and 8:00 PM for each row that is selected from a data set, however, I always get the same random value for each row – I want it to be different for each row. Table schema & data: Сurrent SQL statement: Current results (same time for each row in the
‘MOD’ is not a recognized built-in function name
I wanted to use MOD function in SQL Server 2008R2 and followed this link but still got the message: ‘MOD’ is not a recognized built-in function name. Error: Msg 195, Level 15, State 10, Line 2 ‘MOD’ is not a recognized built-in function name. Why I can’t use this function from the link above? Answer The MOD keyword only exists
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
concatenate tinyint datatypes column using derived column in ssis
I have asked a similar Question before but this time I have problems with single-byte unsigned integer What I am trying to achieve is Column 5: Columns 1, Column 2, Column 3 and Column 4 data types is Tinyint but for Column 5 I need it as a string preferably varchar 100. So I tried: But I can’t seem to
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
T-SQL split string based on delimiter
I have some data that I would like to split based on a delimiter that may or may not exist. Example data: John/Smith Jane/Doe Steve Bob/Johnson I am using the following code to split this data into …