September 26, 2011 at 12:46 am
Hi
I am using follwing query for creating and inserting a table through a procedure..
Alter PROCEDURE CreateInsertTable
@TableName varchar (500),
@InputTable varchar (1000)
AS
BEGIN
declare @sql varchar(4000)
select @sql = ' CREATE TABLE ' + @TableName + '
(RecordNo BIGINT IDENTITY(1,1),
GrpAddressID BIGINT,
OccType1_CommaSeperated VARCHAR(1000) )'
exec (@sql)
declare @ssql nvarchar(4000)
select @ssql = 'INSERT INTO ' + @TableName + ' (GrpAddressID)
SELECT GrpAddressID
FROM '+ @InputTable +'
GROUP BY GrpAddressID
ORDER BY GrpAddressID'
exec (@ssql)
END
Execute statement :
EXEC CreateTable @TableName= 'CommaSEperated3' ,@InputTable='AtulTest'
Its Showing err message :
Msg 8144, Level 16, State 2, Procedure CreateTable, Line 0
Procedure or function CreateTable has too many arguments specified.
Please help to resolve it.
Thanks
Atul
September 26, 2011 at 12:57 am
Execute statement :
EXEC CreateTable TableName= 'CommaSEperated3' ,@InputTable='AtulTest'
Please read your question again by yourself. TableName should be written as @TableName. Also your procedure name is different in definition.
September 26, 2011 at 1:06 am
Sorry...That was my mistake...Actually name of procedure was incorrect...NOw its running fine..
Thanks
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy