|
-
Nov 15th, 2000, 05:08 AM
#1
Thread Starter
Hyperactive Member
Dear All,
I would like to execute a DDL statement(create table) in an SQL server stored procedure. I am formulating the DDL statement in the stored procedure and is saved in a variable of type varchar. How do I execute that DDL statement.
Thanks in advance
-
Nov 15th, 2000, 05:32 PM
#2
Fanatic Member
...
Just a quick example
...
create proc sp_AdhWmCreateRXCRTables with recompile as
begin
declare @command varchar(60)
declare @usename varchar(60)
set nocount on
select @usename = "tblmsdnexpert"
if OBJECT_ID(@usename) is not null
begin
select @command = 'DROP TABLE ' + @usename
exec (@command)
end
select @command = 'CREATE TABLE(......etc"
exec (@command) should do it...
I hope I understood your question correctly..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|