Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

how to alter the column in mysql

$
0
0

i have a table name info 

CREATE TABLE [dbo].[InfoBook](
	[BID] [int] IDENTITY(1,1) NOT NULL,
	[Book_ID] [char](12) NOT NULL,
	[ISBN] [char](16) NOT NULL,
	[BookName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_InfoBook] PRIMARY KEY CLUSTERED
(
	[BID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

but i want to modify it as 

CREATE TABLE [dbo].[InfoBook](
	[BID] [int] IDENTITY(1,1) NOT NULL,[BKID] AS ('BKID00'+right('00000'+CONVERT([varchar](5),[ID]),(5))),
	[ISBN] [char](16) NOT NULL,
	[BookName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_InfoBook] PRIMARY KEY CLUSTERED 
(
	[BID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]



whenever i try to this i shows like this "

There is already an object named 'InfoBook' in the database.

"


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>