SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,456 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi All,
Lets say I have two column like below. How can I combine two column to get the desired output like below. PACKAGENAME column in under varchar datatype whereas TRAN_DATE is under datetime datatype. The purpose I want to combine this two column is to get file name naming format as RL_TB_COMCN_TMI_yyyymmdd_hhmm for my SSIS package. Kindly please help.
-- DDL and sample data population, start
DECLARE @tbl TABLE (PACKAGENAME varchar(200), TRAN_DATE DATETIME)
INSERT INTO @tbl (PACKAGENAME, TRAN_DATE) VALUES
('RL_TB_COMCN_TMI','2022-08-01 20:10:30.000')
SELECT *
FROM @tbl
-- DDL and sample data population, end
SQL version:
You can use the FORMAT function to convert the datetime into the wanted format:
SELECT PACKAGENAME + FORMAT(TRAN_DATE, 'yyyyMMdd_HHmm')
FROM @tbl