About 3,860,000 results
Open links in new tab
  1. Concatenate String + date in SQL Server - Stack Overflow

    Jan 1, 2017 · If you're using SQL Server 2012 or newer, then you can use FORMAT to change a date or datetime into a varchar with the format of your liking. select CONCAT([Key],'-',ID,'-',FORMAT([DATE],'MM-dd-yyyy')) as Key2 from (values (123456789,'09BA2038',convert(date,'2017-01-15',126))) v([Key],ID,[DATE]);

  2. + (String concatenation) (Transact-SQL) - SQL Server | Microsoft …

    Nov 22, 2024 · An operator in a string expression that concatenates two or more character or binary strings, columns, or a combination of strings and column names into one expression (a string operator). For example SELECT 'book'+'case'; returns bookcase .

  3. How to concatenate DateParts in Sql Server - Stack Overflow

    May 23, 2013 · You could use CONVERT with style 114 (section Date and Time Styles): SELECT CONVERT(VARCHAR(5), GETDATE(), 114); or, starting from SQL Server 2012 you can use FORMAT : SELECT FORMAT(GETDATE() , 'hh:mm');

  4. How to concatenate a string and GETDATE() in MSSQL

    Aug 9, 2011 · Depending on the column's definition, you can try to cast or convert the date to the desired type: ([textColumn]) VALUES. ('Date: ' + CAST(GETDATE() as nvarchar(max))) To format the date, use Convert, e.g. INSERT INTO [Table_1] ([textColumn]) VALUES. ('Date: ' + convert(nvarchar(max), GETDATE(), 101)) GO.

  5. SQL Server CONCAT() Function - W3Schools

    The CONCAT() function adds two or more strings together. Note: See also Concat with the + operator and CONCAT_WS(). Syntax

  6. SQL Concatenate Strings Example - MSSQLTips.com - SQL

    Aug 12, 2022 · The + concatenation operator is the most common way to concatenate strings in T-SQL. The following example concatenates the FirstName and LastName with a space between them. Here is the syntax with multiple string values:

  7. CONCAT (Transact-SQL) - SQL Server | Microsoft Learn

    Sep 3, 2024 · CONCAT takes a variable number of string arguments and concatenates (or joins) them into a single string. It requires a minimum of two input values; otherwise, CONCAT raises an error. CONCAT implicitly converts all arguments to string types before concatenation.

  8. sql server - Combine datetime + string to make a proper datetime ...

    I need to take a DATETIME column (Column A) that contains only a date, then add a VARCHAR(5) column (Column B) which contains a 24-hour representation of a time (i.e. 1330) and combine them to get a valid DATETIME to be used in a DATEDIFF command.

  9. SQL Server: How to concatenate string constant with date?

    Oct 23, 2013 · select packageid, status + ' Date : ' + CAST(UpdatedOn AS VARCHAR(10)) from [Shipment_Package]; You might also need to use CONVERT if you want to format the datetime in a specific format.

  10. SQL Concatenate Examples - MSSQLTips.com - SQL Server Tips

    Oct 5, 2021 · In this article we look at how to concatenate SQL Server data using various methods using concatenation operator, functions CONCAT and CONCAT_WS.

  11. Some results have been removed
Refresh