Monday, May 14, 2012

How to append a text field to an existing column in SQL Server

update table set fieldName = 'append string'+ fieldName where conditions

Example:

select *from AM_Invoice where DocumentTypeId = 3 and SalesInvoiceType = 2
update AM_Invoice set InvoiceNumber = 'B/'+InvoiceNumber where DocumentTypeId = 3 and SalesInvoiceType = 2
select *from AM_Invoice where DocumentTypeId = 3 and SalesInvoiceType = 2

result:

appendstring

0 comments:

Post a Comment