Note that there are some explanatory texts on larger screens.

plurals
  1. POmodify the subsequent values of a column in sql table which already contains data
    primarykey
    data
    text
    <p>Hello i am working on a project where i have to store some values in the database on click of a button. This is the code for creating the table:</p> <pre><code>create table dbo.Cpecial_Partner_Info_tbl ( [S.No] int identity(1,1), [Partner ID] varchar(20), [Partner Code] varchar(20), [Partner Name] varchar(100), [Partner Type] varchar(15), [User ID] varchar(50) primary key, [Password] varchar(50), ) </code></pre> <p>in this table i added some values. Now my requirement is that the <strong>partner id</strong> and <strong>partner code</strong> values should come from s.no values. For example, if my <strong>s.no</strong> value is '<strong>1</strong>', the <strong>partnerid</strong> and <strong>parnter code</strong> values should be '<strong>part01</strong>' and '<strong>pc01</strong>' resp. I know the code to create a fresh table and use my condition. This is the code i can use:</p> <pre><code>create table dbo.Cpecial_Partner_Info_tbl ( [S.No] int identity(1,1), [Partner ID] as 'PART' + right('0' + Convert(VarChar(10), [S.No]), 1) persisted, [Partner Code] as 'PC' + right('0' + Convert(VarChar(10), [S.No]), 1) persisted, [Partner Name] varchar(100), [Partner Type] varchar(15), [User ID] varchar(50) primary key, [Password] varchar(50), ) </code></pre> <p>but using the above code means i have to re-create the table. So my question is can i apply the above condition for <strong>partner id</strong> and <strong>partner code</strong> without re-creating the table(as i already have some data in the table which is important) ? Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload