roger5089


sorry all help does not work , if the value like this

table = test

magusageid playid msgtype mchangeprice
------------- --------- ---------- ---------------
35 6 a 400
36 8 a 450

======================================

and other question is if magusageid is use int IDENTITY(1,1)

how can i edit char in my magusageid which like this

magusageid playid msgtype mchangeprice
------------- --------- ---------- ---------------
A000_35 6 a 400
A000_36 8 a 450

sorry the question is

when i insert one row into this table and the data type my want to auto increase 1 to z

in sql i can use IDENTITY this data type to increas but the column of data use only number without char

so i need to know how can i use IDENTITY + char to save data into one row

thank's





Re: IDENTITY modify or edit char into one column

Arnie Rowland


Make an [ID] column, IDENTITY.

Change the MauUsageID column to be a computed column, casting the [ID] value and adding the additional characters required.







Re: IDENTITY modify or edit char into one column

Kent Waldrop No07

Roger:

Part of the answer to your question lies in how you intend to use this.

Code Block

select 'A000_' + convert(varchar(11), magusageid),

playId,

msgtype,

mchangeprice

from test

should get you the output that you are looking for; however, as Arni has indicated you might want to persist the data as a computed column if you are wanting to use something like this as part of a WHERE clause that you might want to index.






Re: IDENTITY modify or edit char into one column

roger5089

but if i use this way before i need to know the next IDENTITY value , what's command my sql can select next IDENTITY value




Re: IDENTITY modify or edit char into one column

Kent Waldrop No07

This is your second post and I still don't understand what you are asking.





Re: IDENTITY modify or edit char into one column

Arnie Rowland

See my last response to your other similar thread.

We need to stop wasting our time on this issue UNTIL you take the time and effort to give us a better explanation, and provide more data.

(This thread is now locked.)