Im using sql server 2008.
how i insert data to sql server 2008 with combine text and number with together ?
for example add record sequency :
me1
me2
me3
me4
.
.
.
how i write query for this ?
Im using sql server 2008.
how i insert data to sql server 2008 with combine text and number with together ?
for example add record sequency :
me1
me2
me3
me4
.
.
.
how i write query for this ?
Try to create Computed Column
. Please refer the links for more details
Computed columnn specification can have column as parameters. Like
('me'+CONVERT([nvarchar](20),[ID],(0)))
, where me
is your text and ID
is the an identity column.
For existing data, you can use an update statement.
WITH X AS
(
SELECT
'me'+CONVERT(NVARCHAR(20), row_number() over (order by ExistingColumn)) RNum,
*
FROM YourTable
)
UPDATE X SET NewColumn=x.RNum