SQL Query Into Delimited String In Stored Procedure
I have the table:
CREATE TABLE [address_tabletype] (
[CONTROL_NUMBER] [varchar](12) NULL,
[ADDRESS1] [varchar](50) NULL,
[ADDRESS2] [varchar](50) NULL,
[CITY] [varchar](50) NULL,
[STATE] [varchar](2) NULL,
[ZIP] [varchar](10) NULL
)
GO
and, say I have the following rows:
2506387 1 2 3 4 5
2506394 1 2 3 4 5
2506403 1 2 3 4 5
I would like to to look like:
2506387|1|2|3|4|5~2506394|1|2|3|4|5~2506403|1|2|3|4|5
I haven't tried anything because I honestly have no idea where to start.
I am using SQL Server 2008 R2, and will be using a temp table to build
this string.
Thank you.
No comments:
Post a Comment