Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can I creae a table and update it's relationships at the same SP?

Status
Not open for further replies.

royc75

Programmer
Jun 1, 2006
127
GB
Hello,

I would like to create a Stored Procedure which will create a table then update it's indexes and relationships.
The problem is that when I write the CREATE TABLE and afterwards the ALTER TABLE it doesn't compile since the Table doesn't exist. So how can I creae a table and update it's indexes and relationships at the same stored procedure? A code example could be helpful...
 
Try putting a GO between the statements..

Create Table...
GO

Alter Table...

GO
 
They try creating an SP to create the table, then call another sp that alters the table.
 
I assume that will work, but I have many Alters to do and I don't want to create different SP for each one. Isn't it possible to do in one SP?
 
just create one procedure that does all the alters. I can't see another way to do it one proc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top