absolutely... except, in your case, you'd need the syntax:
create procedure test
@tablename nvarchar(255),
@columname nvarchar(255)
AS
EXEC ('select ' + @columname + 'from ' + @tablename)
That'll do it for ya.
-Jordon
-----Original Message-----
From: Chris Lott [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 24, 2000 4:06 PM
To: CF-TALK
Subject: Variable in stored procedures
Is there a way to use tsql variables as tablenames and columnames in stored
procedures using SQL Server 7? i.e.:
create procedure test
@tablename nvarchar(255),
@columname nvarchar(255)
as
select @columnname from @tablename
(which doesn't work) etc?
--
Chris
----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.