the procedure goes like this
CREATE PROCEDURE createschema
@schema_name varchar(30)
AS
declare @Schema_Tables nvarchar(300);
BEGIN
SET @Schema_Tables= N'Create schema '+ @Schema_Name
EXEC sp_executesql @Schema_Tables
SET @Schema_Tables= N'CREATE TABLE '+@Schema_Name+ '.UserGroup('
SET @Schema_Tables= @Schema_Tables+ N'Group_id...
User Profile
Collapse
-
thanks for the reply but the thing is
schema name is not fixed it may change i.e this procedures will be called n number of times with different schema names -
select query
[CODE=sql]create procedure [sp_LoginUser]
--inputparameter------------------------------------------------------------------------------
@User_id varchar(50) ,
@SendPassword varchar(50) ,
@Schema_name varchar(50) ,
@dbpassword varchar(15) output,
@Department varchar(20) output
as
declare @sql Nvarchar(300);
declare @id int;
begin transaction
set @sql=N'select... -
Creating schemas
hello expert
problem is
i am using mssql 2005 and i have created a procedure that will create schema and tables under that schema
procedure name is "createschema(< schema_name>) .
code is
SET @Schema_Tables= N'Create schema '+ @Schema_Name
EXEC sp_executesql @Schema_Tables
this creates schema but when create table is encountered
code:
SET @Schema_Tables= N'CREATE TABLE '+@Schema_Name+ '.UserGroup('...
No activity results to display
Show More
Leave a comment: