Just to prove to myself that I'm not going insane...
Is it possible in a SQL Server Stored Procedure to have dynamic table names?
I'm currently trying to;
Create Procedure update_pages (@tablename varchar(255), @rowlist
varchar(255))
as
begin
update [@tablename] inner join Central_Pages on
[@tablename].ID=Central_Pages.ID
set [@tablename].Title=Central_Pages.Title,
[@tablename].Body=Central_Pages.Body
where [@tablename].ID in (@rowlist)
end
GO
When I check the syntax I get "Error 156: Incorrect syntax near the keyword
'inner'."
Please tell me I'm not going completely mad and that it'll let me do this
The problem is that I've got to update upto 200 tables and only specific
pages, I don't specifically want to do this via CF (for obvious reasons)
While I'm on the SP subject - something I've never had to do inside one is
loop over a select and do something on the result... is this possible?
Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133
"Websites for the real world"
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists