Hi
I'm migrating an access db to SQL and have to concatenate few fields to fit into one field.When I create these insert statements, I need the values to be stored in the database with space between the concatenated fields hence when it gets displayed it show as new line for each field. i.e. I'm concatenating several columns into 1 single field. How can I get each column to appear in a new line.
SELECT 'INSERT INTO Table1 (ID, Title) values
(' + rtrim(convert(char(12),ID)) + ', ''' + rtrim(convert(varchar(8),Code)) + ' - ' + Description + ''' );'
FROM Table2
This returns
INSERT INTO Table1 (ID, Title ) values (1, '2072053 - HELLO WORLD' );
When being displayed I would like the Title to be shown as
2072053 -
HELLO WORLD
rather in one line.
Any ideas?
Ta
Nimisha
I'm migrating an access db to SQL and have to concatenate few fields to fit into one field.When I create these insert statements, I need the values to be stored in the database with space between the concatenated fields hence when it gets displayed it show as new line for each field. i.e. I'm concatenating several columns into 1 single field. How can I get each column to appear in a new line.
SELECT 'INSERT INTO Table1 (ID, Title) values
(' + rtrim(convert(char(12),ID)) + ', ''' + rtrim(convert(varchar(8),Code)) + ' - ' + Description + ''' );'
FROM Table2
This returns
INSERT INTO Table1 (ID, Title ) values (1, '2072053 - HELLO WORLD' );
When being displayed I would like the Title to be shown as
2072053 -
HELLO WORLD
rather in one line.
Any ideas?
Ta
Nimisha