Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored procedure for Inserting records

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-06 : 08:44:13
Ganeshkumar writes "I had created a stored procedure which receives the tablename and values as parameter, which look like this
Create Procedure insertproc (@tablename varchar(20), @colvalues varchar(255)) as
begin
insert into @tablename values (@colvalues)
end

When i compile this stor proc, I'm getting a syntax error. I want to pass the tablename as one parameter and values concatenated in one string as another parameter from my front end, so that this stored proc should do the rest.

I'm doing this because i don't know which table the user is going to select and so i don't know the number of columns that table is going to have.

One way of solving it is, I can pass this insert statement with variables from the front-end to SQL Server, so that the SQL Server will do the rest. Whereas If I want a stored procedure to do this job, is it possible?"
   

- Advertisement -