I am using excel concatenation to generate SQL insert statement but i find it very hard to define the concatenation for the below SQL values…can anyone advise? on the concatenation formula to use?
VALUES (
NEWID(),'ABC', 'ABC', 'ABC', 'abc', 'abc', 'abc', NULL, CONVERT(datetime, '1999/01/01', 101)
, CONVERT(datetime, '1999/12/31', 101), 1, 0, 1, LOWER(NEWID())
, 'abc', getdate(), 'system'
, getdate());
Note: When you see
\in the above it means the line joins to the next line. The entire formula should be on a single line.I have replaced the first two fixed values of “ABC” with
A2andB2being cells from the sheet, e.g. you may have this formula inX2, which you would copy down. If your cell values themselves can contain single quotes, it becomes more complicated and you’ll need to add SUBSTITUTE to double them up. e.g.