Click here to Skip to main content
15,919,931 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in an sql server having stored procedures are there by using store procedure we can create a table are not inside the procedure any one please clear description this problem
Posted
Updated 9-Apr-12 19:40pm
v2

If you write a create statement inside a procedure directly it will thorough an error like 'Create or Alter statement should be the first statement in a query batch'. You can acheive required functionality by executing the create script using dynamic sql inside the stored procedure.

But before going to those lengths, why you want to create a table inside a procedure? If you want to store some temp data do it with a table variable. Can you post your requirment?
 
Share this answer
 
we can definitely create a table and also a temp table into a stored procedure..
 
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