Click here to Skip to main content
15,942,710 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,
I have been created the table using store procedure.that query is
create procedure studenttable
create table studenttable(Stud_regno int ,Stud_id int primary key,Stud_name varchar(50),Dob date,gender varchar(20),father_name varchar(50),mother_name varchar(50),father_occupation varchar(40),mother_occupation varchar(40),contact_no bigint,email_id varchar(200),street varchar(250),city varchar(50),state varchar(100), country varchar(50),zipcode bigint);

I want to alter this table as follows
stud_regno, stud_id - auto increament
phone number and zipcode - varchar
please help me how to modify this store procedure
Advance thanks
[no name] 16-Jul-12 15:55pm    
Are you altering a stored procedure or are you altering a table? SQL Server or MySql?

1 solution

why you use create permanent table using stored procedure.
procedure is use which required frequently but table creation is not need frequently.

always avoid same name of different objects.
try to intial as tbl_<tablename>,sp_<storedprocedure name="">
if not avoidable

alter procedure studenttable
alter table studenttable alter column[stud_regno] IDENTITY(1,1) NOT NULL;
alter table studenttable alter column[Stud_id ] IDENTITY(1,1) NOT NULL;
alter table studenttable alter column[contact_no ] varchar;
alter table studenttable alter column[zipcode ] varchar;

hopefully this answer is help you.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900