Forums

This topic is locked

Dynamic SP... aint executing

Posted 09 Dec 2002 18:43:38
1
has voted
09 Dec 2002 18:43:38 Matthijs Horsman posted:
Hello All!

I am trying to make th follwing SP to execute... but nothing happens...

CREATE PROCEDURE upDateMedew
(
@node varChar(250),
@val varChar(250),
@MID varChar(50)
)
AS
UPDATE medewerkers
SET
@node = @val
WHERE MEDEW_ID = @MID
GO

I wanna pass the column from th eprevious page, so i don't have to make like 20 sp but can just do with one!

Anybody any idea why it aint working??

Thanx

Matthijs
----------------
DWMX/W-XP-PRO/IIS/ASP-VB/MS-SQL

Replies

Replied 09 Dec 2002 19:45:09
09 Dec 2002 19:45:09 Owen Eastwick replied:
You can't have a field name as a parameter like this, try:

CREATE PROCEDURE upDateMedew

@node varChar(250),
@val varChar(250),
@MID varChar(50)

AS

DECALARE @strQL varchar (500)

SET @strSQL = 'UPDATE medewerkers SET ' + @node + ' = ' + @val + ' WHERE MEDEW_ID = ' + @MID

EXECUTE (@strSQL)
GO

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Reply to this topic