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)
 Dynamic insert but dont know column name

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-06 : 08:37:30
Gregor writes "All my lookup tables have 3 columns
column 1 = int (identity)
column 2 = varchar(255)
column 3 = int

I need a dynamic sproc which will let me insert into these tables - so far ive got this but im stuck with how to update the second column.


CREATE PROCEDURE usp_update_lookup_table
( @lookup_tablename varchar(200),
@lookup_desc varchar(100),
@lookup_active int

)
AS

Declare @SQL VarChar(1000)

SELECT @SQL = 'UPDATE '
SELECT @SQL = @SQL + @lookup_tablename
SELECT @SQL = @SQL + ' SET '
SELECT @SQL = @SQL + @lookup_desc
SELECT @SQL = @SQL + '= @lookup_desc'

print (@SQL)
--Exec ( @SQL)

RETURN
@@ERROR
GO
Regards
Gregor"

Nazim
A custom title

1408 Posts

Posted - 2002-03-06 : 08:41:04
I have seen this before.

http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=13470



--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -